MCPcopy
hub / github.com/pytest-dev/pytest / test_keyboard_in_sessionstart

Method test_keyboard_in_sessionstart

testing/test_terminal.py:318–334  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

316 result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
317
318 def test_keyboard_in_sessionstart(self, pytester: Pytester) -> None:
319 pytester.makeconftest(
320 """
321 def pytest_sessionstart():
322 raise KeyboardInterrupt
323 """
324 )
325 pytester.makepyfile(
326 """
327 def test_foobar():
328 pass
329 """
330 )
331
332 result = pytester.runpytest(no_reraise_ctrlc=True)
333 assert result.ret == 2
334 result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
335
336 def test_collect_single_item(self, pytester: Pytester) -> None:
337 """Use singular 'item' when reporting a single test item"""

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeconftestMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected