|
1 | 1 | import os |
2 | 2 |
|
3 | | -from .helpers import TEST_DATA_PATH, find_test_line_number, get_absolute_test_id |
| 3 | +from .helpers import ( |
| 4 | + TEST_DATA_PATH, |
| 5 | + find_class_line_number, |
| 6 | + find_test_line_number, |
| 7 | + get_absolute_test_id, |
| 8 | +) |
4 | 9 |
|
5 | 10 | # This file contains the expected output dictionaries for tests discovery and is used in test_discovery.py. |
6 | 11 |
|
|
95 | 100 | "unittest_pytest_same_file.py::TestExample", |
96 | 101 | unit_pytest_same_file_path, |
97 | 102 | ), |
| 103 | + "lineno": find_class_line_number("TestExample", unit_pytest_same_file_path), |
98 | 104 | }, |
99 | 105 | { |
100 | 106 | "name": "test_true_pytest", |
|
207 | 213 | "unittest_folder/test_add.py::TestAddFunction", |
208 | 214 | test_add_path, |
209 | 215 | ), |
| 216 | + "lineno": find_class_line_number("TestAddFunction", test_add_path), |
210 | 217 | }, |
211 | 218 | { |
212 | 219 | "name": "TestDuplicateFunction", |
|
235 | 242 | "unittest_folder/test_add.py::TestDuplicateFunction", |
236 | 243 | test_add_path, |
237 | 244 | ), |
| 245 | + "lineno": find_class_line_number( |
| 246 | + "TestDuplicateFunction", test_add_path |
| 247 | + ), |
238 | 248 | }, |
239 | 249 | ], |
240 | 250 | }, |
|
288 | 298 | "unittest_folder/test_subtract.py::TestSubtractFunction", |
289 | 299 | test_subtract_path, |
290 | 300 | ), |
| 301 | + "lineno": find_class_line_number( |
| 302 | + "TestSubtractFunction", test_subtract_path |
| 303 | + ), |
291 | 304 | }, |
292 | 305 | { |
293 | 306 | "name": "TestDuplicateFunction", |
|
316 | 329 | "unittest_folder/test_subtract.py::TestDuplicateFunction", |
317 | 330 | test_subtract_path, |
318 | 331 | ), |
| 332 | + "lineno": find_class_line_number( |
| 333 | + "TestDuplicateFunction", test_subtract_path |
| 334 | + ), |
319 | 335 | }, |
320 | 336 | ], |
321 | 337 | }, |
|
553 | 569 | "parametrize_tests.py::TestClass", |
554 | 570 | parameterize_tests_path, |
555 | 571 | ), |
| 572 | + "lineno": find_class_line_number("TestClass", parameterize_tests_path), |
556 | 573 | "children": [ |
557 | 574 | { |
558 | 575 | "name": "test_adding", |
|
929 | 946 | "test_multi_class_nest.py::TestFirstClass", |
930 | 947 | TEST_MULTI_CLASS_NEST_PATH, |
931 | 948 | ), |
| 949 | + "lineno": find_class_line_number("TestFirstClass", TEST_MULTI_CLASS_NEST_PATH), |
932 | 950 | "children": [ |
933 | 951 | { |
934 | 952 | "name": "TestSecondClass", |
|
938 | 956 | "test_multi_class_nest.py::TestFirstClass::TestSecondClass", |
939 | 957 | TEST_MULTI_CLASS_NEST_PATH, |
940 | 958 | ), |
| 959 | + "lineno": find_class_line_number( |
| 960 | + "TestSecondClass", TEST_MULTI_CLASS_NEST_PATH |
| 961 | + ), |
941 | 962 | "children": [ |
942 | 963 | { |
943 | 964 | "name": "test_second", |
|
982 | 1003 | "test_multi_class_nest.py::TestFirstClass::TestSecondClass2", |
983 | 1004 | TEST_MULTI_CLASS_NEST_PATH, |
984 | 1005 | ), |
| 1006 | + "lineno": find_class_line_number( |
| 1007 | + "TestSecondClass2", TEST_MULTI_CLASS_NEST_PATH |
| 1008 | + ), |
985 | 1009 | "children": [ |
986 | 1010 | { |
987 | 1011 | "name": "test_second2", |
|
1227 | 1251 | "same_function_new_class_param.py::TestNotEmpty", |
1228 | 1252 | TEST_DATA_PATH / "same_function_new_class_param.py", |
1229 | 1253 | ), |
| 1254 | + "lineno": find_class_line_number( |
| 1255 | + "TestNotEmpty", TEST_DATA_PATH / "same_function_new_class_param.py" |
| 1256 | + ), |
1230 | 1257 | }, |
1231 | 1258 | { |
1232 | 1259 | "name": "TestEmpty", |
|
1298 | 1325 | "same_function_new_class_param.py::TestEmpty", |
1299 | 1326 | TEST_DATA_PATH / "same_function_new_class_param.py", |
1300 | 1327 | ), |
| 1328 | + "lineno": find_class_line_number( |
| 1329 | + "TestEmpty", TEST_DATA_PATH / "same_function_new_class_param.py" |
| 1330 | + ), |
1301 | 1331 | }, |
1302 | 1332 | ], |
1303 | 1333 | } |
|
1371 | 1401 | "test_param_span_class.py::TestClass1", |
1372 | 1402 | TEST_DATA_PATH / "test_param_span_class.py", |
1373 | 1403 | ), |
| 1404 | + "lineno": find_class_line_number( |
| 1405 | + "TestClass1", TEST_DATA_PATH / "test_param_span_class.py" |
| 1406 | + ), |
1374 | 1407 | }, |
1375 | 1408 | { |
1376 | 1409 | "name": "TestClass2", |
|
1427 | 1460 | "test_param_span_class.py::TestClass2", |
1428 | 1461 | TEST_DATA_PATH / "test_param_span_class.py", |
1429 | 1462 | ), |
| 1463 | + "lineno": find_class_line_number( |
| 1464 | + "TestClass2", TEST_DATA_PATH / "test_param_span_class.py" |
| 1465 | + ), |
1430 | 1466 | }, |
1431 | 1467 | ], |
1432 | 1468 | } |
|
1503 | 1539 | "pytest_describe_plugin/describe_only.py::describe_A", |
1504 | 1540 | describe_only_path, |
1505 | 1541 | ), |
| 1542 | + "lineno": find_class_line_number("describe_A", describe_only_path), |
1506 | 1543 | } |
1507 | 1544 | ], |
1508 | 1545 | } |
|
1586 | 1623 | "pytest_describe_plugin/nested_describe.py::describe_list::describe_append", |
1587 | 1624 | nested_describe_path, |
1588 | 1625 | ), |
| 1626 | + "lineno": find_class_line_number( |
| 1627 | + "describe_append", nested_describe_path |
| 1628 | + ), |
1589 | 1629 | }, |
1590 | 1630 | { |
1591 | 1631 | "name": "describe_remove", |
|
1614 | 1654 | "pytest_describe_plugin/nested_describe.py::describe_list::describe_remove", |
1615 | 1655 | nested_describe_path, |
1616 | 1656 | ), |
| 1657 | + "lineno": find_class_line_number( |
| 1658 | + "describe_remove", nested_describe_path |
| 1659 | + ), |
1617 | 1660 | }, |
1618 | 1661 | ], |
1619 | 1662 | "id_": get_absolute_test_id( |
1620 | 1663 | "pytest_describe_plugin/nested_describe.py::describe_list", |
1621 | 1664 | nested_describe_path, |
1622 | 1665 | ), |
| 1666 | + "lineno": find_class_line_number("describe_list", nested_describe_path), |
1623 | 1667 | } |
1624 | 1668 | ], |
1625 | 1669 | } |
|
0 commit comments