Skip to content

Add option to force the dependency to be collected Β #37

@pecalleja

Description

@pecalleja

It would be nice an option in the dependency that force to collect and execute the required test. For example:

import pytest

@pytest.mark.dependency()
@pytest.mark.xfail(reason="deliberate fail")
def test_a():
    assert False

@pytest.mark.dependency()
def test_b():
    pass

@pytest.mark.dependency(depends=["test_a"])
def test_c():
    pass

@pytest.mark.dependency(depends=["test_b"], collect=True)
def test_d():
    pass

@pytest.mark.dependency(depends=["test_b", "test_c"])
def test_e():
    pass

if execute only the test_d the collector also will select the test_b because the hard restriction of the dependency collect=True

If you think this is a good idea I can work on this feature. kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions