Skip to content

[self-tests] test_skips_pytest_fixtures fails against pytest 8.4.0+ #33

@stanislavlevin

Description

@stanislavlevin

As from pytest 8.4.0 test_skips_pytest_fixtures fails:

_________________ TestRelaxedMixin.test_skips_pytest_fixtures __________________

self = <test_collection.TestRelaxedMixin object at 0x7f2337e3a4e0>
testdir = <Testdir local('/usr/src/tmp/pytest-of-builder/pytest-0/test_skips_pytest_fixtures0')>

    def test_skips_pytest_fixtures(self, testdir):
        testdir.makepyfile(
            foo="""
            from pytest import fixture
    
            @fixture
            def pls_noload():
                yield
    
            def actual_test_here():
                pass
        """
        )
        stdout = testdir.runpytest("-v").stdout.str()
        assert "actual test here" in stdout
        # will be in stdout as a failure and warning if bug present
>       assert "pls_noload" not in stdout
E       AssertionError: assert 'pls_noload' not in '===========...============'
E         
E         'pls_noload' is contained here:
E           ============================= test session starts ==============================
E           platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0 -- /usr/src/RPM/BUILD/python3-module-pytest-relaxed-2.0.2/.run_venv/bin/python3
E           cachedir: .pytest_cache
E           rootdir: /usr/src/tmp/pytest-of-builder/pytest-0/test_skips_pytest_fixtures0
E           plugins: relaxed-2.0.2...
E         
E         ...Full output truncated (14 lines hidden), use '-vv' to show

/usr/src/RPM/BUILD/python3-module-pytest-relaxed-2.0.2/tests/test_collection.py:198: AssertionError
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0 -- /usr/src/RPM/BUILD/python3-module-pytest-relaxed-2.0.2/.run_venv/bin/python3
cachedir: .pytest_cache
rootdir: /usr/src/tmp/pytest-of-builder/pytest-0/test_skips_pytest_fixtures0
plugins: relaxed-2.0.2
collecting ... collected 2 items
pls noload
actual test here

=================================== FAILURES ===================================
__________________________________ pls_noload __________________________________
Fixture "pls_noload" called directly. Fixtures are not meant to be called directly,
but are created automatically when test functions request them as parameters.
See https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and
https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions