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

Method test_no_raise_message

testing/python/raises.py:143–157  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

141 raise KeyError("oops")
142
143 def test_no_raise_message(self) -> None:
144 try:
145 pytest.raises(ValueError, int, "0")
146 except pytest.fail.Exception as e:
147 assert e.msg == f"DID NOT RAISE {repr(ValueError)}"
148 else:
149 assert False, "Expected pytest.raises.Exception"
150
151 try:
152 with pytest.raises(ValueError):
153 pass
154 except pytest.fail.Exception as e:
155 assert e.msg == f"DID NOT RAISE {repr(ValueError)}"
156 else:
157 assert False, "Expected pytest.raises.Exception"
158
159 @pytest.mark.parametrize("method", ["function", "function_match", "with"])
160 def test_raises_cyclic_reference(self, method):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected