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

Method test_nested_import_error

testing/acceptance_test.py:164–180  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

162 assert result.ret == 1
163
164 def test_nested_import_error(self, pytester: Pytester) -> None:
165 p = pytester.makepyfile(
166 """
167 import import_fails
168 def test_this():
169 assert import_fails.a == 1
170 """
171 )
172 pytester.makepyfile(import_fails="import does_not_work")
173 result = pytester.runpytest(p)
174 result.stdout.fnmatch_lines(
175 [
176 "ImportError while importing test module*",
177 "*No module named *does_not_work*",
178 ]
179 )
180 assert result.ret == 2
181
182 def test_not_collectable_arguments(self, pytester: Pytester) -> None:
183 p1 = pytester.makepyfile("")

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected