diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-01-27 10:02:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-27 10:02:52 -0500 |
| commit | 0551421f082eea3f633bc6be23c16a04483aca98 (patch) | |
| tree | 76c5b37e3a56a232b4b5b66ab7e933edbe64cd25 /pkg_resources/tests/test_pkg_resources.py | |
| parent | 28872fc9e7d15a1acf3bc557795c76c5e64dbad3 (diff) | |
| parent | 78fd73026ad7284819936b651f7cfbe8a1ec98c8 (diff) | |
| download | python-setuptools-git-0551421f082eea3f633bc6be23c16a04483aca98.tar.gz | |
Merge branch 'master' into license-fix-357
Diffstat (limited to 'pkg_resources/tests/test_pkg_resources.py')
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 62a39b8f..416f9aff 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -236,3 +236,56 @@ class TestDeepVersionLookupDistutils: req = pkg_resources.Requirement.parse('foo>=1.9') dist = pkg_resources.WorkingSet([env.paths['lib']]).find(req) assert dist.version == version + + @pytest.mark.parametrize( + 'unnormalized, normalized', + [ + ('foo', 'foo'), + ('foo/', 'foo'), + ('foo/bar', 'foo/bar'), + ('foo/bar/', 'foo/bar'), + ], + ) + def test_normalize_path_trailing_sep(self, unnormalized, normalized): + """Ensure the trailing slash is cleaned for path comparison. + + See pypa/setuptools#1519. + """ + result_from_unnormalized = pkg_resources.normalize_path(unnormalized) + result_from_normalized = pkg_resources.normalize_path(normalized) + assert result_from_unnormalized == result_from_normalized + + @pytest.mark.skipif( + os.path.normcase('A') != os.path.normcase('a'), + reason='Testing case-insensitive filesystems.', + ) + @pytest.mark.parametrize( + 'unnormalized, normalized', + [ + ('MiXeD/CasE', 'mixed/case'), + ], + ) + def test_normalize_path_normcase(self, unnormalized, normalized): + """Ensure mixed case is normalized on case-insensitive filesystems. + """ + result_from_unnormalized = pkg_resources.normalize_path(unnormalized) + result_from_normalized = pkg_resources.normalize_path(normalized) + assert result_from_unnormalized == result_from_normalized + + @pytest.mark.skipif( + os.path.sep != '\\', + reason='Testing systems using backslashes as path separators.', + ) + @pytest.mark.parametrize( + 'unnormalized, expected', + [ + ('forward/slash', 'forward\\slash'), + ('forward/slash/', 'forward\\slash'), + ('backward\\slash\\', 'backward\\slash'), + ], + ) + def test_normalize_path_backslash_sep(self, unnormalized, expected): + """Ensure path seps are cleaned on backslash path sep systems. + """ + result = pkg_resources.normalize_path(unnormalized) + assert result.endswith(expected) |
