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

Method test_keyboard_in_sessionstart

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

Source from the content-addressed store, hash-verified

284 result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
285
286 def test_keyboard_in_sessionstart(self, pytester: Pytester) -> None:
287 pytester.makeconftest(
288 """
289 def pytest_sessionstart():
290 raise KeyboardInterrupt
291 """
292 )
293 pytester.makepyfile(
294 """
295 def test_foobar():
296 pass
297 """
298 )
299
300 result = pytester.runpytest(no_reraise_ctrlc=True)
301 assert result.ret == 2
302 result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
303
304 def test_collect_single_item(self, pytester: Pytester) -> None:
305 """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