File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 389
389
# This is the expected output for the nested_folder tests.
390
390
# └── parametrize_tests.py
391
391
# └── test_adding
392
- # └── test_adding [3+5-8]
393
- # └── test_adding [2+4-6]
394
- # └── test_adding [6+9-16]
392
+ # └── [3+5-8]
393
+ # └── [2+4-6]
394
+ # └── [6+9-16]
395
395
parameterize_tests_path = os .fspath (TEST_DATA_PATH / "parametrize_tests.py" )
396
396
parametrize_tests_expected_output = {
397
397
"name" : ".data" ,
411
411
"id_" : "parametrize_tests.py::test_adding" ,
412
412
"children" : [
413
413
{
414
- "name" : "test_adding [3+5-8]" ,
414
+ "name" : "[3+5-8]" ,
415
415
"path" : parameterize_tests_path ,
416
416
"lineno" : find_test_line_number (
417
417
"test_adding[3+5-8]" ,
422
422
"runID" : "parametrize_tests.py::test_adding[3+5-8]" ,
423
423
},
424
424
{
425
- "name" : "test_adding [2+4-6]" ,
425
+ "name" : "[2+4-6]" ,
426
426
"path" : parameterize_tests_path ,
427
427
"lineno" : find_test_line_number (
428
428
"test_adding[2+4-6]" ,
433
433
"runID" : "parametrize_tests.py::test_adding[2+4-6]" ,
434
434
},
435
435
{
436
- "name" : "test_adding [6+9-16]" ,
436
+ "name" : "[6+9-16]" ,
437
437
"path" : parameterize_tests_path ,
438
438
"lineno" : find_test_line_number (
439
439
"test_adding[6+9-16]" ,
Original file line number Diff line number Diff line change @@ -257,6 +257,9 @@ def build_test_tree(session: pytest.Session) -> TestNode:
257
257
test_file_node ["children" ].append (test_class_node )
258
258
elif hasattr (test_case , "callspec" ): # This means it is a parameterized test.
259
259
function_name : str = ""
260
+ # parameterized test cases cut the repetitive part of the name off.
261
+ name_split = test_node ["name" ].split ("[" )[1 ]
262
+ test_node ["name" ] = "[" + name_split
260
263
try :
261
264
function_name = test_case .originalname # type: ignore
262
265
function_test_case = function_nodes_dict [function_name ]
You can’t perform that action at this time.
0 commit comments