Skip to content

The first test is run in skipped package #5830

Open
@zefirior

Description

@zefirior

Hi,
In my use case I need to skip all tests in some python package. For this purpose I added pytestmark to __init__.py:

# __init__.py
import pytest
pytestmark = pytest.mark.skip

I expect all tests to be skipped in this package. However, the first test in this package runs.

Here is a failed test for this issue:

def test_skip_package(testdir):
    testdir.makepyfile(
        __init__="""
        import pytest
        pytestmark = pytest.mark.skip
    """
    )

    testdir.makepyfile(
        """
        import pytest
        def test_skip1():
            assert 0
        def test_skip2():
            assert 0
    """
    )

    result = testdir.inline_run()
    _, skipped, _ = result.listoutcomes()
    assert len(skipped) == 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions