From 22b35ee31890bd9b278a59c0aad00b4a88ee1ca5 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Thu, 8 Feb 2024 08:25:56 -0600 Subject: [PATCH 1/2] pytest: Fix warning regarding usefixtures conftest.py:52 libtmux/conftest.py:52: 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 def setup( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html --- conftest.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/conftest.py b/conftest.py index 876090be4..3f7bc577b 100644 --- a/conftest.py +++ b/conftest.py @@ -47,12 +47,19 @@ def set_home( monkeypatch.setenv("HOME", str(user_path)) +@pytest.fixture(autouse=True, scope="function") +def setup_fn( + clear_env: None, +) -> None: + """Function-level test configuration fixtures for pytest.""" + pass + + @pytest.fixture(autouse=True, scope="session") -@pytest.mark.usefixtures("clear_env") -def setup( +def setup_session( request: pytest.FixtureRequest, config_file: pathlib.Path, ) -> None: - """Configure test fixtures for pytest.""" + """Session-level test configuration for pytest.""" if USING_ZSH: request.getfixturevalue("zshrc") From 0b3624c783471bf69d233e8dafb84744d1f1e8a7 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Thu, 8 Feb 2024 13:00:10 -0600 Subject: [PATCH 2/2] docs(CHANGES): Note pytest warning fix --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index e95bfa8fc..f040a346e 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,10 @@ $ pip install --user --upgrade --pre libtmux +### Tests + +- pytest: Fix `usefixture` warning (#519) + ## libtmux 0.27.1 (2024-02-07) ### Packaging