Skip to content

Unclear why pytest.raises() isn't catching this exception #12015

Discussion options

You must be logged in to vote

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

@pytest.fixture
def force_oserror() -> Callable[[], None]:
   return force_oserror_nonfixture

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Evan0000000000
Comment options

@Evan0000000000
Comment options

@RonnyPfannschmidt
Comment options

Answer selected by Evan0000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants