I have a simple Python library, for which I use the following command to run tests:
python setup.py pytest
The following test works as expected:
def test_out():
assert 1 == 2
Test result:
platform linux -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: /media/drive2/src
collected 1 item
tests/test_error.py F
However, when @pytest.fixture is added, the test is not executed:
import pytest
@pytest.fixture
def test_out():
assert 1 == 2
Test result:
platform linux -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: /media/drive2/src
collected 0 items
What is the reason for this behavior, and how can @pytest.fixture be added in a way that won't prevent the test from running?
(I want to use capsys.readouterr(), so I believe @pytest.fixture is needed.)