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

Method test_nested_import_error

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

Source from the content-addressed store, hash-verified

41 # assert colreports[1].report.failed
42
43 def test_nested_import_error(self, pytester: Pytester) -> None:
44 tfile = pytester.makepyfile(
45 """
46 import import_fails
47 def test_this():
48 assert import_fails.a == 1
49 """,
50 import_fails="""
51 import does_not_work
52 a = 1
53 """,
54 )
55 reprec = pytester.inline_run(tfile)
56 values = reprec.getfailedcollections()
57 assert len(values) == 1
58 out = str(values[0].longrepr)
59 assert out.find("does_not_work") != -1
60
61 def test_raises_output(self, pytester: Pytester) -> None:
62 reprec = pytester.inline_runsource(

Callers

nothing calls this directly

Calls 3

getfailedcollectionsMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected