Unclear why pytest.raises() isn't catching this exception #12015
-
Given this pared down example:
The first test passes, the second reports the OSError as if it was unexpected, despite the raises() context. I think the answer is that a fixture is expected to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
if you check carefully you will see that the error is reported at setup time, before the test even runs if you want to have a fixture that provides a function, its going to look more like @pytest.fixture
def force_oserror() -> Callable[[], None]:
return force_oserror_nonfixture |
Beta Was this translation helpful? Give feedback.
if you check carefully you will see that the error is reported at setup time, before the test even runs
the fixture is executed before the test even starts
if you want to have a fixture that provides a function, its going to look more like