Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select which test should be distributed and which test should be run without concurrence #1040

Open
mscheltienne opened this issue Mar 14, 2024 · 4 comments

Comments

@mscheltienne
Copy link

mscheltienne commented Mar 14, 2024

I would like to use pytest-xdist in mne-lsl: mne-tools/mne-lsl#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.

@mscheltienne
Copy link
Author

The difference between this request and my alternative lies that developers won't accidently run the test suit with xdist and without the -m "not no_xdist". The -m flag is not needed anymore as xdist will handle dispatching correctly.

@RonnyPfannschmidt
Copy link
Member

When xdist is active, no tests run in the controling process

There's no plan for a meta scheduler that ensures noncoop tests are executed on a single node in isolation

@mscheltienne
Copy link
Author

mscheltienne commented Mar 22, 2024

OK thank you! Could that be a feature request then? Some test need to be run in isolation; and preventing an entire test suite to run on xdist because of a minority is disappointing.

If there is no plan/desire to add this feature, feel free to close this issue!

@RonnyPfannschmidt
Copy link
Member

there is a desire to add it, but lack of engineering time to build it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants