Skip to content

PytestRemovedIn9Warning: Marks applied to fixtures have no effect #337

@blthayer

Description

@blthayer

Hello, and thank you for pytest_cases!

With the latest pytest_cases (3.8.3) and pytest (8.1.1), we get a deprecation warning when parametrizing fixtures:

(venv) $ tree tests/
tests/
├── conftest.py
└── test_thing.py

0 directories, 2 files
(venv) $ cat tests/conftest.py 
from pytest_cases import fixture, parametrize

@fixture()
@parametrize("hello", ("world", "friend"))
def some_fixture(hello):
    print(hello)

(venv) $ cat tests/test_thing.py 
def test_dummy(some_fixture):
    assert True

(venv) $ pytest tests
==================================================== test session starts =====================================================
platform linux -- Python 3.11.7, pytest-8.1.1, pluggy-1.4.0
rootdir: <redacted>
plugins: cases-3.8.3
collected 2 items                                                                                                            

tests/test_thing.py ..                                                                                                 [100%]

====================================================== warnings summary ======================================================
venv/lib/python3.11/site-packages/pytest_cases/common_pytest.py:47
  /home/bthayer/git/tmp/venv/lib/python3.11/site-packages/pytest_cases/common_pytest.py:47: PytestRemovedIn9Warning: Marks applied to fixtures have no effect
  See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
    return pytest.fixture(**kwargs)(f)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================ 2 passed, 1 warning in 0.00s ================================================

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