pytest-dev / pytest-dev/pytest-xdist

Have pytest-xdist respect the order set by pytest-order

Open
#1,099 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

Is there any chance to make pytest-xdist respect the order set by pytest-order (just the priority order):

@pytest.mark.order(2)
def test_foo():
    assert True

@pytest.mark.order(1)
def test_bar():
    assert True

NOT the dependency order:

@pytest.mark.dependency(depends=["test_b"])
def test_a():
    assert True

@pytest.mark.dependency
def test_b():
    assert True

@pytest.mark.order(after="test_module2.py::test1")
def test1():
    pass

def test2():
    pass

or implement a similar behaviour directly in pytest-xdist?
the current available options are not good enough, i have to be sure the slowest tests run first (and i know that in advance) to optimise the test time, distributing them according to the file or group is not ensuring this behaviour.
I also can't use this plugin: https://github.com/klimkin/pytest-slowest-first because it requires the tests to have run before but the machine on which my tests run is a clean machine every time.
Many thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing pytest-xdist's existing test distribution options and pytest-order's priority-order semantics. Reproduce the priority and dependency examples, then define completion as distributing tests so the declared priority order is respected without treating dependency order as the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.