Skip to content

Plugin performing automatic setup - best practices? #10445

Answered by LewisGaul
LewisGaul asked this question in Q&A
Discussion options

You must be logged in to vote

@nicoddemus From your comment above, can I take it implicitly from absence of disagreement that you agree with the following conclusions I'm arriving at?

  • It's correct/recommended for plugin setup to be performed via pytest_sessionstart() (or pytest_runtestloop()) rather than an autouse fixture in the case where it must run before all other fixtures.
  • Skipping tests from an autouse session fixture doesn't really work because the first test cannot be skipped - alternatives include using pytest_collection_modifyitems() and a per-test autouse fixture.

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
5 replies
@LewisGaul
Comment options

@LewisGaul
Comment options

@LewisGaul
Comment options

@nicoddemus
Comment options

@LewisGaul
Comment options

Comment options

You must be logged in to vote
5 replies
@nicoddemus
Comment options

@nicoddemus
Comment options

@LewisGaul
Comment options

@nicoddemus
Comment options

@LewisGaul
Comment options

Answer selected by LewisGaul
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