pytest-dev / pytest-dev/pytest

Can't add fixture to doctest_namespace

Open
#5,852 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

pip list: pip-list.txt
Minimal example project: pytest_test.zip

Steps to repro: Run pytest --doctest-modules inside the unzipped project.

As you can see, I'm injecting temp_h5 into doctest_namespace but it isn't recognized. The conftest.py is picked up as seen by the other test.

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

Unpack the linked minimal example project, inspect its conftest.py, and first run pytest --doctest-modules as described. Trace how doctest_namespace is applied during doctest-modules collection; done means the injected temp_h5 fixture is recognized while the other conftest test continues to pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.