This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new fb99b1dc0e0 Fix pytest class-scoped fixture deprecation warning in 
extract_permissions tests (#71002)
fb99b1dc0e0 is described below

commit fb99b1dc0e0f0acbe3475139d8b78bd573571b60
Author: Elad Kalif <[email protected]>
AuthorDate: Tue Aug 4 01:26:22 2026 +0300

    Fix pytest class-scoped fixture deprecation warning in extract_permissions 
tests (#71002)
    
    pytest 9.1 deprecates defining a class-scoped fixture as a plain
    instance method, since attributes set on self in the fixture aren't
    visible to test methods (each test gets a new instance while the
    fixture runs once per class). test_extract_permissions.py had two
    such fixtures, all_entries and rst_content, triggering
    PytestRemovedIn10Warning on every run. Neither fixture actually
    relied on self, so marking them as @classmethod removes the warning
    with no behavior change.
---
 scripts/tests/ci/prek/test_extract_permissions.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/tests/ci/prek/test_extract_permissions.py 
b/scripts/tests/ci/prek/test_extract_permissions.py
index 40be37dff0d..2900c66f603 100644
--- a/scripts/tests/ci/prek/test_extract_permissions.py
+++ b/scripts/tests/ci/prek/test_extract_permissions.py
@@ -627,7 +627,8 @@ class TestExtractAllPermissions:
     """
 
     @pytest.fixture(scope="class")
-    def all_entries(self) -> list[PermissionEntry]:
+    @classmethod
+    def all_entries(cls) -> list[PermissionEntry]:
         return extract_all_permissions(PUBLIC_ROUTES_DIR)
 
     def test_extracts_non_empty_result(self, all_entries):
@@ -769,7 +770,8 @@ class TestExtractAllPermissions:
 
 class TestRenderRst:
     @pytest.fixture(scope="class")
-    def rst_content(self) -> str:
+    @classmethod
+    def rst_content(cls) -> str:
         entries = extract_all_permissions(PUBLIC_ROUTES_DIR)
         return render_rst(entries)
 

Reply via email to