pytest-dev / pytest-dev/pytest-xdist
Select which test should be distributed and which test should be run without concurrence
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
I would like to use pytest-xdist in mne-lsl: https://github.com/mne-tools/mne-lsl/pull/229
However, in the test suite, some test need to be run while no other test are running because they spawn network resources which might be pick-up by other tests. Example:
def test1(...):
spawn_network_resources()
...
def test2(...):
resources = resolve_all_network_resources()
assert len(resources) == 0
spawn_network_resources()
resources = resolve_all_network_resources()
assert len(resources) == 1
In this example, test2 would be affected by test1 run in a different worker.
To avoid this problem, I would like new markers from pytest-xdist to mark which test should not be distributed and should be run through --dist no, either before or after all the other tests distributed to workers.
e.g.
@pytest.mark.no_xdist
def test2(...):
My current alternative idea is to create this marker and to run 2 separate pytest command.
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
Start by reviewing the pytest-xdist PR #229 and the issue's proposed no_xdist marker and two-command alternative. Define how marked tests should be selected and ordered relative to distributed tests, then verify that the requested behavior works for tests that spawn and resolve network resources.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100