summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-21 17:20:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-03-22 07:04:13 -0400
commit66173dc24db5e6800483e0faddf583e80d9eb9b3 (patch)
tree290844e83b57e29f9ff20799fa0010978990bedb /tests/helpers.py
parente613a75b7c20bec00b4564f2d87812a8fd7b8e11 (diff)
downloadpython-coveragepy-git-66173dc24db5e6800483e0faddf583e80d9eb9b3.tar.gz
refactor: nice_file can be used as a function
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index c916c8a2..262d9301 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -93,6 +93,12 @@ def make_file(filename, text="", bytes=b"", newline=None):
return filename
+def nice_file(*fparts):
+ """Canonicalize the file name composed of the parts in `fparts`."""
+ fname = os.path.join(*fparts)
+ return os.path.normcase(os.path.abspath(os.path.realpath(fname)))
+
+
class CheckUniqueFilenames(object):
"""Asserts the uniqueness of file names passed to a function."""
def __init__(self, wrapped):