Skip to content

Reorder test execution based on dependencies? #20

@jwineinger

Description

@jwineinger

Is there any intent to reorder test execution according to dependencies? The current behavior I observe is that if I have two tests, where the first depends on the second, the first is just skipped. It would be preferable to reorder them so that they can both execute, rather than relying on source code order.

import pytest


@pytest.mark.dependency(depends=["test_parent"])
def test_child():
    pass


@pytest.mark.dependency
def test_parent():
    pass
$ pytest
==== test session starts ====
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /tests, inifile:
plugins: dependency-0.3.2
collected 2 items

test_file.py::test_child SKIPPED
test_file.py::test_parent PASSED

==== 2 passed, 1 skipped in 0.01 seconds ====

NOTE: https://github.com/ftobia/pytest-ordering does some of this, but requires explicit ordering. I'd rather just define the dependencies and let the system figure it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions