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

Function test_notify_exception

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

Source from the content-addressed store, hash-verified

1812
1813
1814def test_notify_exception(pytester: Pytester, capfd) -> None:
1815 config = pytester.parseconfig()
1816 with pytest.raises(ValueError) as excinfo:
1817 raise ValueError(1)
1818 config.notify_exception(excinfo, config.option)
1819 _, err = capfd.readouterr()
1820 assert "ValueError" in err
1821
1822 class A:
1823 def pytest_internalerror(self):
1824 return True
1825
1826 config.pluginmanager.register(A())
1827 config.notify_exception(excinfo, config.option)
1828 _, err = capfd.readouterr()
1829 assert not err
1830
1831 config = pytester.parseconfig("-p", "no:terminal")
1832 with pytest.raises(ValueError) as excinfo:
1833 raise ValueError(1)
1834 config.notify_exception(excinfo, config.option)
1835 _, err = capfd.readouterr()
1836 assert "ValueError" in err
1837
1838
1839def 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