From 44ce9b8e4c3b218008033f1951ec850da55eab41 Mon Sep 17 00:00:00 2001 From: chima Date: Fri, 13 Aug 2021 15:40:35 +0100 Subject: fix symlink tests --- tests/test_types.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'tests') 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 -- cgit v1.2.1