MCPcopy Index your code
hub / github.com/pytest-dev/pytest / test_basic_testitem_events

Method test_basic_testitem_events

testing/test_session.py:11–41  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

9
10class SessionTests:
11 def test_basic_testitem_events(self, pytester: Pytester) -> None:
12 tfile = pytester.makepyfile(
13 """
14 def test_one():
15 pass
16 def test_one_one():
17 assert 0
18 def test_other():
19 raise ValueError(23)
20 class TestClass(object):
21 def test_two(self, someargs):
22 pass
23 """
24 )
25 reprec = pytester.inline_run(tfile)
26 passed, skipped, failed = reprec.listoutcomes()
27 assert len(skipped) == 0
28 assert len(passed) == 1
29 assert len(failed) == 3
30
31 def end(x):
32 return x.nodeid.split("::")[-1]
33
34 assert end(failed[0]) == "test_one_one"
35 assert end(failed[1]) == "test_other"
36 itemstarted = reprec.getcalls("pytest_itemcollected")
37 assert len(itemstarted) == 4
38 # XXX check for failing funcarg setup
39 # colreports = reprec.getcalls("pytest_collectreport")
40 # assert len(colreports) == 4
41 # assert colreports[1].report.failed
42
43 def test_nested_import_error(self, pytester: Pytester) -> None:
44 tfile = pytester.makepyfile(

Callers

nothing calls this directly

Calls 4

listoutcomesMethod · 0.80
getcallsMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected