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

Function test_notify_exception

testing/test_config.py:1226–1248  ·  view source on GitHub ↗
(pytester: Pytester, capfd)

Source from the content-addressed store, hash-verified

1224
1225
1226def test_notify_exception(pytester: Pytester, capfd) -> None:
1227 config = pytester.parseconfig()
1228 with pytest.raises(ValueError) as excinfo:
1229 raise ValueError(1)
1230 config.notify_exception(excinfo, config.option)
1231 _, err = capfd.readouterr()
1232 assert "ValueError" in err
1233
1234 class A:
1235 def pytest_internalerror(self):
1236 return True
1237
1238 config.pluginmanager.register(A())
1239 config.notify_exception(excinfo, config.option)
1240 _, err = capfd.readouterr()
1241 assert not err
1242
1243 config = pytester.parseconfig("-p", "no:terminal")
1244 with pytest.raises(ValueError) as excinfo:
1245 raise ValueError(1)
1246 config.notify_exception(excinfo, config.option)
1247 _, err = capfd.readouterr()
1248 assert "ValueError" in err
1249
1250
1251def test_no_terminal_discovery_error(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 5

notify_exceptionMethod · 0.80
registerMethod · 0.80
AClass · 0.70
parseconfigMethod · 0.45
readouterrMethod · 0.45

Tested by

no test coverage detected