pytest-dev / pytest-dev/pytest-xdist
Session-Scoped Fixtures are not Session-Scoped with Pytest-Xdist
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
I am fairly new to this project. I very recently migrated a software project test-suite from nosetest to pytest, mainly because of the Xdist benefits I had heard of.
The problem is that my Tests are depending on a big fixture setup (table creation + heavy loading of data) that I would like to share across all my tests.
The current Xdist behaviour is as follow:
- Collect test
- Split tests amongst the user-defined number of processes
- Launch a pytest session for each worker
Obviously, if each test depend on a heavy fixture, then multiplying the number of creation per number of worker is not going to help.
Additionally, it simply breaks the expected pytest behaviour for 'session' scoped fixtures.
I think this should be fairly simple to address this problem although I didn't take a really deep look into it. If you need help to solve this problem, I am more than willing to contribute if you feel this suggestion for improvement is relevant.
Greetings.
Contributor guide
No contributing guide indexed for this repository
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
The issue names no source files, tests, or entry points. Start by reading pytest-xdist's worker/session setup and existing fixture-related tests, then determine how session-scoped fixtures should behave across workers. Done means the intended sharing behavior is defined and covered by tests without breaking distributed execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100