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

Method test_nested_import_error

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

Source from the content-addressed store, hash-verified

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