summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-01-02 11:33:52 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-01-02 12:31:49 -0500
commitd08e6d08cb01d07209bcc5a96807e48eeb593ed9 (patch)
tree35a5658e4441cde4d32e09cda15a0de42cada672 /tests
parent3f0bce2f5f4658bfa1d9cd6ddb2f6d7e520897e8 (diff)
downloadpython-coveragepy-git-d08e6d08cb01d07209bcc5a96807e48eeb593ed9.tar.gz
fix: relative_files should keep relative path maps. #1519
Diffstat (limited to 'tests')
-rw-r--r--tests/test_files.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_files.py b/tests/test_files.py
index 54c91628..2d029a04 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -17,7 +17,9 @@ from coverage.files import (
GlobMatcher, ModuleMatcher, PathAliases, TreeMatcher, abs_file,
actual_path, find_python_files, flat_rootname, globs_to_regex,
)
+
from tests.coveragetest import CoverageTest
+from tests.helpers import os_sep
class FilesTest(CoverageTest):
@@ -415,8 +417,16 @@ class PathAliasesTest(CoverageTest):
# The result shouldn't start with "./" if the map result didn't.
aliases = PathAliases(relative=rel_yn)
aliases.add('*/project', '.')
- # Because the map result has no slash, the actual result is os-dependent.
- self.assert_mapped(aliases, '/ned/home/project/src/a.py', f'src{os.sep}a.py')
+ self.assert_mapped(aliases, '/ned/home/project/src/a.py', os_sep('src/a.py'))
+
+ def test_relative_pattern(self):
+ aliases = PathAliases(relative=True)
+ aliases.add(".tox/*/site-packages", "src")
+ self.assert_mapped(
+ aliases,
+ ".tox/py314/site-packages/proj/a.py",
+ os_sep("src/proj/a.py"),
+ )
def test_multiple_patterns(self, rel_yn):
# also test the debugfn...