Skip to content

Commit c8c07a0

Browse files
authored
changes to support pytest 8 (#22799)
fixes: #22798
1 parent 67ac41c commit c8c07a0

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

pythonFiles/tests/pytestadapter/expected_discovery_test_output.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
# └── test_top_folder.py
318318
# └── test_top_function_t
319319
# └── test_top_function_f
320-
# └── nested_folder_one
320+
# └── z_nested_folder_one
321321
# └── test_bottom_folder.py
322322
# └── test_bottom_function_t
323323
# └── test_bottom_function_f
@@ -326,14 +326,14 @@
326326
TEST_DATA_PATH / "dual_level_nested_folder" / "test_top_folder.py"
327327
)
328328

329-
test_nested_folder_one_path = (
330-
TEST_DATA_PATH / "dual_level_nested_folder" / "nested_folder_one"
329+
test_z_nested_folder_one_path = (
330+
TEST_DATA_PATH / "dual_level_nested_folder" / "z_nested_folder_one"
331331
)
332332

333333
test_bottom_folder_path = (
334334
TEST_DATA_PATH
335335
/ "dual_level_nested_folder"
336-
/ "nested_folder_one"
336+
/ "z_nested_folder_one"
337337
/ "test_bottom_folder.py"
338338
)
339339

@@ -392,10 +392,10 @@
392392
],
393393
},
394394
{
395-
"name": "nested_folder_one",
396-
"path": os.fspath(test_nested_folder_one_path),
395+
"name": "z_nested_folder_one",
396+
"path": os.fspath(test_z_nested_folder_one_path),
397397
"type_": "folder",
398-
"id_": os.fspath(test_nested_folder_one_path),
398+
"id_": os.fspath(test_z_nested_folder_one_path),
399399
"children": [
400400
{
401401
"name": "test_bottom_folder.py",
@@ -412,11 +412,11 @@
412412
),
413413
"type_": "test",
414414
"id_": get_absolute_test_id(
415-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
415+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
416416
test_bottom_folder_path,
417417
),
418418
"runID": get_absolute_test_id(
419-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
419+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
420420
test_bottom_folder_path,
421421
),
422422
},
@@ -429,11 +429,11 @@
429429
),
430430
"type_": "test",
431431
"id_": get_absolute_test_id(
432-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
432+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
433433
test_bottom_folder_path,
434434
),
435435
"runID": get_absolute_test_id(
436-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
436+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
437437
test_bottom_folder_path,
438438
),
439439
},

pythonFiles/tests/pytestadapter/expected_execution_test_output.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
# └── test_top_folder.py
309309
# └── test_top_function_t: success
310310
# └── test_top_function_f: failure
311-
# └── nested_folder_one
311+
# └── z_nested_folder_one
312312
# └── test_bottom_folder.py
313313
# └── test_bottom_function_t: success
314314
# └── test_bottom_function_f: failure
@@ -318,7 +318,7 @@
318318
dual_level_nested_folder_bottom_path = (
319319
TEST_DATA_PATH
320320
/ "dual_level_nested_folder"
321-
/ "nested_folder_one"
321+
/ "z_nested_folder_one"
322322
/ "test_bottom_folder.py"
323323
)
324324
dual_level_nested_folder_execution_expected_output = {
@@ -345,11 +345,11 @@
345345
"subtest": None,
346346
},
347347
get_absolute_test_id(
348-
"nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
348+
"z_nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
349349
dual_level_nested_folder_bottom_path,
350350
): {
351351
"test": get_absolute_test_id(
352-
"nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
352+
"z_nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
353353
dual_level_nested_folder_bottom_path,
354354
),
355355
"outcome": "success",
@@ -358,11 +358,11 @@
358358
"subtest": None,
359359
},
360360
get_absolute_test_id(
361-
"nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
361+
"z_nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
362362
dual_level_nested_folder_bottom_path,
363363
): {
364364
"test": get_absolute_test_id(
365-
"nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
365+
"z_nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
366366
dual_level_nested_folder_bottom_path,
367367
),
368368
"outcome": "failure",
@@ -479,7 +479,7 @@
479479
dual_level_nested_folder_bottom_path = (
480480
TEST_DATA_PATH
481481
/ "dual_level_nested_folder"
482-
/ "nested_folder_one"
482+
/ "z_nested_folder_one"
483483
/ "test_bottom_folder.py"
484484
)
485485
unittest_folder_add_path = TEST_DATA_PATH / "unittest_folder" / "test_add.py"

pythonFiles/tests/pytestadapter/test_discovery.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ def test_pytest_config_file():
233233
actual = runner_with_cwd(
234234
[
235235
"--collect-only",
236-
"-c",
237-
"tests/pytest.ini",
236+
"tests/",
238237
],
239238
TEST_DATA_PATH / "root",
240239
)

pythonFiles/tests/pytestadapter/test_execution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ def test_bad_id_error_execution():
193193
[
194194
"dual_level_nested_folder/test_top_folder.py::test_top_function_t",
195195
"dual_level_nested_folder/test_top_folder.py::test_top_function_f",
196-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
197-
"dual_level_nested_folder/nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
196+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_t",
197+
"dual_level_nested_folder/z_nested_folder_one/test_bottom_folder.py::test_bottom_function_f",
198198
],
199199
expected_execution_test_output.dual_level_nested_folder_execution_expected_output,
200200
),

pythonFiles/vscode_pytest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def create_session_node(session: pytest.Session) -> TestNode:
540540
"""
541541
node_path = get_node_path(session)
542542
return {
543-
"name": session.name,
543+
"name": node_path.name,
544544
"path": node_path,
545545
"type_": "folder",
546546
"children": [],

0 commit comments

Comments
 (0)