def test_no_swallow(self): with self.assertNoSwallow() as raised: raise exception_handling.noswallow(raised)
def test_no_swallow(): raised = CustomException() with pytest.raises(CustomException) as caught: with exception_handling.get_exception_swallowing_context(): raise exception_handling.noswallow(raised) assert raised is caught.value