pytest.raises(Exception) is what you need. Code import pytest def test_passes(): with pytest.raises(Exception) as e_info: x = 1 / 0 def ...
確定! 回上一頁