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

Tests are incorrectly split if paired with mark expressions #17

Closed
matthewshirley opened this issue Jun 15, 2021 · 0 comments · Fixed by #18
Closed

Tests are incorrectly split if paired with mark expressions #17

matthewshirley opened this issue Jun 15, 2021 · 0 comments · Fixed by #18

Comments

@matthewshirley
Copy link
Contributor

matthewshirley commented Jun 15, 2021

Splitting tests when using pytest marker expressions is appearing to break the splitting. For example, I added this to a Django project that has a mixture of unit and functional tests. The functional tests are marked with @pytest.mark.browser while other test have different or no marks. There are 347 tests with the marker. This is how the collection preformed when I split only the browser tests:

pytest -m "browser" --splits 3 --group 1

[pytest-split] Running group 1/2
collected 5399 items / 5399 deselected                                                                                                                                 

pytest -m "browser" --splits 2 --group 2

[pytest-split] Running group 2/2
collected 5399 items / 5052 deselected / 347 selected

Steps to reproduce

See test case in #18. If you execute this code with tryfirst=True, one group will deselect all tests instead of splitting.

Proposal

See #18.

In summary, I think we should change pytest_collection_modifyitems to trylast=True instead of tryfirst=True to fix the aforementioned bug and performance issue.

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

Successfully merging a pull request may close this issue.

1 participant