summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorchima <chimaataman@gmail.com>2021-08-13 15:40:35 +0100
committerchima <chimaataman@gmail.com>2021-08-13 15:40:35 +0100
commit44ce9b8e4c3b218008033f1951ec850da55eab41 (patch)
treeeb438666cf740d0e3e492b1461ec5b1b4bc97351 /tests
parent7e6a98f7effee29e304af9e0ed16a01947077c79 (diff)
downloadclick-44ce9b8e4c3b218008033f1951ec850da55eab41.tar.gz
fix symlink tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_types.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/test_types.py b/tests/test_types.py
index 43e34bb..dff8172 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -127,16 +127,14 @@ def test_symlink_resolution(tmpdir, sym_file, abs_fun):
ctx = click.Context(click.Command("do_stuff"))
rv = click.Path(resolve_path=True).convert(sym_path, None, ctx)
- if os.path.isabs(rv):
- # os.readlink prepends path prefixes to absolute
- # links in windows.
- # https://docs.microsoft.com/en-us/windows/win32/
- # ... fileio/naming-a-file#win32-file-namespaces
- #
- # Here we strip win32 path prefix from the resolved path
- rv_drive, rv_path = os.path.splitdrive(rv)
- stripped_rv_drive = rv_drive.split(os.path.sep)[-1]
- rv = os.path.join(stripped_rv_drive, rv_path)
-
- assert pathlib.Path(rv) == pathlib.Path(real_path)
+ # os.readlink prepends path prefixes to absolute
+ # links in windows.
+ # https://docs.microsoft.com/en-us/windows/win32/
+ # ... fileio/naming-a-file#win32-file-namespaces
+ #
+ # Here we strip win32 path prefix from the resolved path
+ rv_drive, rv_path = os.path.splitdrive(rv)
+ stripped_rv_drive = rv_drive.split(os.path.sep)[-1]
+ rv = os.path.join(stripped_rv_drive, rv_path)
+
assert rv == real_path