Skip to content

The first test is run in skipped package #5830

Open

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

Activity

  1. added
    topic: marksrelated to marks, either the general marks or builtin
    type: bugproblem that needs to be addressed
    on Sep 13, 2019
  2. asottile commented on Nov 15, 2019

    @asottile
    Member

    just a heads up, I'm looking to revert this in #6197 (at least temporarily) as it caused some regressions

  3. asottile commented on Nov 15, 2019

    @asottile
  4. asottile commented on Nov 15, 2019

    @asottile
  5. blueyed commented on Nov 15, 2019

    @blueyed
    Contributor

    @zefirior
    As asked in #6197 (comment): aren't you supposed to have -o python_files to include the __init__.py (as a package)?

  6. added 2 commits that reference this issue on Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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