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

Function test_assertion_location_with_coverage

testing/test_assertion.py:1662–1679  ·  view source on GitHub ↗

This used to report the wrong location when run with coverage (#5754).

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1660
1661
1662def test_assertion_location_with_coverage(pytester: Pytester) -> None:
1663 """This used to report the wrong location when run with coverage (#5754)."""
1664 p = pytester.makepyfile(
1665 """
1666 def test():
1667 assert False, 1
1668 assert False, 2
1669 """
1670 )
1671 result = pytester.runpytest(str(p))
1672 result.stdout.fnmatch_lines(
1673 [
1674 "> assert False, 1",
1675 "E AssertionError: 1",
1676 "E assert False",
1677 "*= 1 failed in*",
1678 ]
1679 )

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected