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

Method test_raises_output

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

Source from the content-addressed store, hash-verified

59 assert out.find("does_not_work") != -1
60
61 def test_raises_output(self, pytester: Pytester) -> None:
62 reprec = pytester.inline_runsource(
63 """
64 import pytest
65 def test_raises_doesnt():
66 with pytest.raises(ValueError):
67 int("3")
68 """
69 )
70 _passed, _skipped, failed = reprec.listoutcomes()
71 assert len(failed) == 1
72 out = failed[0].longrepr.reprcrash.message # type: ignore[union-attr]
73 assert "DID NOT RAISE" in out
74
75 def test_syntax_error_module(self, pytester: Pytester) -> None:
76 reprec = pytester.inline_runsource("this is really not python")

Callers

nothing calls this directly

Calls 2

listoutcomesMethod · 0.80
inline_runsourceMethod · 0.45

Tested by

no test coverage detected