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

PytestRemovedIn9Warning: Marks applied to fixtures have no effect #337

Closed
blthayer opened this issue Mar 13, 2024 · 1 comment · Fixed by #340
Closed

PytestRemovedIn9Warning: Marks applied to fixtures have no effect #337

blthayer opened this issue Mar 13, 2024 · 1 comment · Fixed by #340

Comments

@blthayer
Copy link

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 ================================================
@smarie
Copy link
Owner

smarie commented Apr 4, 2024

Thanks @blthayer ! Indeed. I fixed this and will release soon

smarie added a commit that referenced this issue Apr 4, 2024
…ect`. Fixed #337 (#340)

Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
smarie added a commit that referenced this issue Sep 26, 2024
* Fixed `PytestRemovedIn9Warning: Marks applied to fixtures have no effect`. Fixed #337

* Fixed GHA build and nox scripts following recipe from makefun. Fixed #352

* Added changelog

* Trigger workflow again

* Hopefully fixed 3.5 GHA

* Fixed test with pytest 8.1+

* Fixed test with pytest 8.1+

* Fixed GHA for 3.5

* Fixed GHA issue

* Fixed 3.5 GHA runs

* Fixed CI

---------

Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants