aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/pytest
diff options
context:
space:
mode:
authorprettyboy <prettyboy@yandex-team.com>2023-01-20 09:21:05 +0300
committerprettyboy <prettyboy@yandex-team.com>2023-01-20 09:21:05 +0300
commit284f4572c3f7ace1bfe951c3242e0676e29d3690 (patch)
tree343664963a1e7a246457b9d563d79cd956d182f2 /library/python/pytest
parent2db3d52777ce3feefdfc7ee592b95935ed59452a (diff)
downloadydb-284f4572c3f7ace1bfe951c3242e0676e29d3690.tar.gz
[library/python/pytest/yatest_tools] Fixed unify_path for path that fully matches module name
Diffstat (limited to 'library/python/pytest')
-rw-r--r--library/python/pytest/ut/test_tools.py1
-rw-r--r--library/python/pytest/yatest_tools.py4
2 files changed, 4 insertions, 1 deletions
diff --git a/library/python/pytest/ut/test_tools.py b/library/python/pytest/ut/test_tools.py
index de85b1a6e0..412ec42d24 100644
--- a/library/python/pytest/ut/test_tools.py
+++ b/library/python/pytest/ut/test_tools.py
@@ -80,6 +80,7 @@ def test_split_node_id_with_test_suffix(parameters, node_id, expected_class_name
("/arcadia/data/b/a/test.py::test_b_a", "b.a.test.py", "test_b_a"),
("/arcadia/data/a/test.py::test_a", "a.test.py", "test_a"),
("/arcadia/data/test.py::test", "test.py", "test"),
+ ("b/a/test.py::test_b_a", "b.a.test.py", "test_b_a"),
],
)
def test_path_resolving_for_local_conftest_load_policy(
diff --git a/library/python/pytest/yatest_tools.py b/library/python/pytest/yatest_tools.py
index 723be996ed..bdcd0cc0b1 100644
--- a/library/python/pytest/yatest_tools.py
+++ b/library/python/pytest/yatest_tools.py
@@ -366,7 +366,9 @@ def _unify_path(path):
assert path.endswith(py_ext), path
parts = path[:-len(py_ext)].split(SEP)
- for p in reversed(parts):
+ # Use SEP as trailing terminator to make an extra step
+ # and find a proper match when parts is a full matching path
+ for p in reversed([SEP] + parts):
if p in node:
node = node[p]
res.append(p)