# Check that my_statement(myarg) raises ValueError import pytest def test_testname(): with pytest.raises(ValueError): my_statement(myarg)