Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The first test is run in skipped package #5830

Open
zefirior opened this issue Sep 8, 2019 · 4 comments
Open

The first test is run in skipped package #5830

zefirior opened this issue Sep 8, 2019 · 4 comments

Comments

@zefirior
Copy link

@zefirior zefirior commented Sep 8, 2019

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
@asottile

This comment has been minimized.

Copy link
Member

@asottile asottile commented Nov 15, 2019

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

@asottile asottile reopened this Nov 15, 2019
@asottile

This comment was marked as outdated.

Copy link
Member

@asottile asottile commented Nov 15, 2019

@blueyed found a way to fix this without revert

@asottile asottile closed this Nov 15, 2019
@asottile

This comment was marked as outdated.

Copy link
Member

@asottile asottile commented Nov 15, 2019

jk, we're reverting :)

@asottile asottile reopened this Nov 15, 2019
@blueyed

This comment has been minimized.

Copy link
Contributor

@blueyed blueyed commented Nov 15, 2019

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

bors bot added a commit to duckinator/bork that referenced this issue Nov 17, 2019
Merge #76
76: Update pytest to 5.2.4 r=duckinator a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.2** to **5.2.4**.



<details>
  <summary>Changelog</summary>
  
  
   ### 5.2.4
   ```
   =========================

Bug Fixes
---------

- `6194 &lt;https://github.com/pytest-dev/pytest/issues/6194&gt;`_: Fix incorrect discovery of non-test ``__init__.py`` files.


- `6197 &lt;https://github.com/pytest-dev/pytest/issues/6197&gt;`_: Revert &quot;The first test in a package (``__init__.py``) marked with ``pytest.mark.skip`` is now correctly skipped.&quot;.
   ```
   
  
  
   ### 5.2.3
   ```
   =========================

Bug Fixes
---------

- `5830 &lt;https://github.com/pytest-dev/pytest/issues/5830&gt;`_: The first test in a package (``__init__.py``) marked with ``pytest.mark.skip`` is now correctly skipped.


- `6099 &lt;https://github.com/pytest-dev/pytest/issues/6099&gt;`_: Fix ``--trace`` when used with parametrized functions.


- `6183 &lt;https://github.com/pytest-dev/pytest/issues/6183&gt;`_: Using ``request`` as a parameter name in ``pytest.mark.parametrize`` now produces a more
  user-friendly error.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
bors bot added a commit to rehandalal/therapist that referenced this issue Nov 19, 2019
Merge #103
103: Update pytest to 5.2.4 r=rehandalal a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.2** to **5.2.4**.



<details>
  <summary>Changelog</summary>
  
  
   ### 5.2.4
   ```
   =========================

Bug Fixes
---------

- `6194 &lt;https://github.com/pytest-dev/pytest/issues/6194&gt;`_: Fix incorrect discovery of non-test ``__init__.py`` files.


- `6197 &lt;https://github.com/pytest-dev/pytest/issues/6197&gt;`_: Revert &quot;The first test in a package (``__init__.py``) marked with ``pytest.mark.skip`` is now correctly skipped.&quot;.
   ```
   
  
  
   ### 5.2.3
   ```
   =========================

Bug Fixes
---------

- `5830 &lt;https://github.com/pytest-dev/pytest/issues/5830&gt;`_: The first test in a package (``__init__.py``) marked with ``pytest.mark.skip`` is now correctly skipped.


- `6099 &lt;https://github.com/pytest-dev/pytest/issues/6099&gt;`_: Fix ``--trace`` when used with parametrized functions.


- `6183 &lt;https://github.com/pytest-dev/pytest/issues/6183&gt;`_: Using ``request`` as a parameter name in ``pytest.mark.parametrize`` now produces a more
  user-friendly error.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.