pytest-dev / pytest-dev/pytest
Using monkeypatch in non function scoped fixture
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Originally reported by: BitBucket: ColeVsCode, GitHub: ColeVsCode
Hi, I'd like to be able to create a module or session scoped fixture that uses monkeypatch.
@pytest.fixture(scope='session')
def usermanager(monkeypatch):
...
This raises an error. There's some comments about this on the pytest-dev list.
https://mail.python.org/pipermail/pytest-dev/2012-November/002157.html
Is there a work-around in the mean time that I can use to change the scope of the monkeypatch fixture?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the session-scoped fixture example and read the linked pytest-dev discussion; the issue names no repository files, tests, or entry points. Done means establishing an accepted way to use monkeypatch from module- or session-scoped fixtures, or documenting a supported workaround, with coverage for the requested scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100