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

Function test_quit_with_swallowed_SystemExit

testing/test_debugging.py:1161–1186  ·  view source on GitHub ↗

Test that debugging's pytest_configure is re-entrant.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1159
1160
1161def test_quit_with_swallowed_SystemExit(pytester: Pytester) -> None:
1162 """Test that debugging's pytest_configure is re-entrant."""
1163 p1 = pytester.makepyfile(
1164 """
1165 def call_pdb_set_trace():
1166 __import__('pdb').set_trace()
1167
1168
1169 def test_1():
1170 try:
1171 call_pdb_set_trace()
1172 except SystemExit:
1173 pass
1174
1175
1176 def test_2():
1177 pass
1178 """
1179 )
1180 child = pytester.spawn_pytest(str(p1))
1181 child.expect("Pdb")
1182 child.sendline("q")
1183 child.expect_exact("Exit: Quitting debugger")
1184 rest = child.read().decode("utf8")
1185 assert "no tests ran" in rest
1186 TestPDB.flush(child)
1187
1188
1189@pytest.mark.parametrize("fixture", ("capfd", "capsys"))

Callers

nothing calls this directly

Calls 4

makepyfileMethod · 0.45
spawn_pytestMethod · 0.45
readMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected