pytest-dev / pytest-dev/pytest

Extra Documentation For Importing Session Scoped Fixtures From A File

Open
#13,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: fixtures
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

@RonnyPfannschmidt confirmed that issue #3217 is a feature, not a bug. This however created hours of confusion for me as it led to test-breaking exceptions that could not be explained by the relevant pytest docs.

Describe the solution you'd like

A Python warning explaining this behaviour when manually importing session-scoped fixtures would have allowed this problem to be instantly debugged.

Alternative Solutions

Adding a warning to the aforementioned docs / the docstring of the pytest fixture scope attribute.

Additional context

Love the library. Just looking out for the next person.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #3217 and the linked pytest fixture-scope documentation, focusing on manually importing session-scoped fixtures from a file. Decide whether the behavior is best addressed with a Python warning or clearer documentation, then verify that the confusing exception scenario is explained or produces the intended warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.