MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_keep_duplicates

Function test_keep_duplicates

testing/python/collect.py:1383–1400  ·  view source on GitHub ↗

Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Use --keep-duplicates to collect tests from duplicate directories.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1381
1382
1383def 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
1403def test_package_collection_infinite_recursion(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
mkdirMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected