Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pythonFiles/tests/pytestadapter/.data/parametrize_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@
)
def test_adding(actual, expected):
assert eval(actual) == expected


# Testing pytest with parametrized tests. All three pass.
# The tests ids are parametrize_tests.py::test_under_ten[1] and so on.
@pytest.mark.parametrize("num", range(1, 3)) # test_marker--test_under_ten
def test_under_ten(num):
assert num < 10
24 changes: 24 additions & 0 deletions pythonFiles/tests/pytestadapter/expected_discovery_test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,30 @@
},
],
},
{
"name": "test_under_ten",
"path": parameterize_tests_path,
"type_": "function",
"children": [
{
"name": "[1]",
"path": parameterize_tests_path,
"lineno": "15",
"type_": "test",
"id_": "parametrize_tests.py::test_under_ten[1]",
"runID": "parametrize_tests.py::test_under_ten[1]",
},
{
"name": "[2]",
"path": parameterize_tests_path,
"lineno": "15",
"type_": "test",
"id_": "parametrize_tests.py::test_under_ten[2]",
"runID": "parametrize_tests.py::test_under_ten[2]",
},
],
"id_": "parametrize_tests.py::test_under_ten",
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion pythonFiles/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def build_test_tree(session: pytest.Session) -> TestNode:
# parameterized test cases cut the repetitive part of the name off.
name_split = test_node["name"].split("[")
test_node["name"] = "[" + name_split[1]
parent_path = os.fspath(test_case.path)
parent_path = os.fspath(test_case.path) + "::" + name_split[0]
try:
function_name = test_case.originalname # type: ignore
function_test_case = function_nodes_dict[parent_path]
Expand Down