Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Use --keep-duplicates to collect tests from duplicate directories.
(pytester: Pytester)
| 1381 | |
| 1382 | |
| 1383 | def test_keep_duplicates(pytester: Pytester) -> None: |
| 1384 | """Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) |
| 1385 | |
| 1386 | Use --keep-duplicates to collect tests from duplicate directories. |
| 1387 | """ |
| 1388 | a = pytester.mkdir("a") |
| 1389 | fh = a.joinpath("test_a.py") |
| 1390 | fh.write_text( |
| 1391 | textwrap.dedent( |
| 1392 | """\ |
| 1393 | import pytest |
| 1394 | def test_real(): |
| 1395 | pass |
| 1396 | """ |
| 1397 | ) |
| 1398 | ) |
| 1399 | result = pytester.runpytest("--keep-duplicates", str(a), str(a)) |
| 1400 | result.stdout.fnmatch_lines(["*collected 2 item*"]) |
| 1401 | |
| 1402 | |
| 1403 | def test_package_collection_infinite_recursion(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected