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

Method test_hook_call

testing/test_assertrewrite.py:1511–1530  ·  view source on GitHub ↗
(self, pytester: Pytester, flag_on, hook_on)

Source from the content-addressed store, hash-verified

1509 )
1510
1511 def test_hook_call(self, pytester: Pytester, flag_on, hook_on) -> None:
1512 pytester.makepyfile(
1513 """\
1514 def test_simple():
1515 a=1
1516 b=2
1517 c=3
1518 d=0
1519
1520 assert a+b == c+d
1521
1522 # cover failing assertions with a message
1523 def test_fails():
1524 assert False, "assert with message"
1525 """
1526 )
1527 result = pytester.runpytest()
1528 result.stdout.fnmatch_lines(
1529 "*Assertion Passed: a+b == c+d (1 + 2) == (3 + 0) at line 7*"
1530 )
1531
1532 def test_hook_call_with_parens(self, pytester: Pytester, flag_on, hook_on) -> None:
1533 pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected