From 66173dc24db5e6800483e0faddf583e80d9eb9b3 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 21 Mar 2021 17:20:23 -0400 Subject: refactor: nice_file can be used as a function --- tests/helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/helpers.py') 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): -- cgit v1.2.1