tests: Use class methods for class scoped fixtures

Using class-scoped fixture as instance method is deprecated in pytest 9.1 and
support will be removed in 10.0.

See: https://docs.pytest.org/en/stable/deprecations.html#class-scoped-fixture-as-instance-method

Tests:

- Run functional tests for samba, matrixsynapse (unrelated failure), and
bepasty.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2026-07-22 19:08:06 -07:00 committed by James Valleroy
parent c1aeb1f661
commit d2a959a277
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 9 additions and 6 deletions

View File

@ -17,7 +17,8 @@ class TestMatrixSynapseApp(functional.BaseAppTests):
diagnostics_delay = 1
@pytest.fixture(scope='class', autouse=True)
def fixture_setup(self, session_browser):
@classmethod
def fixture_setup(cls, session_browser):
"""Setup the app."""
functional.login(session_browser)
functional.domain_add(session_browser, 'mydomain.example')

View File

@ -21,7 +21,8 @@ class TestSambaApp(functional.BaseAppTests):
has_web = False
@pytest.fixture(scope='class', autouse=True)
def fixture_setup(self, session_browser):
@classmethod
def fixture_setup(cls, session_browser):
"""Setup the app."""
functional.login(session_browser)
functional.networks_set_firewall_zone(session_browser, 'internal')

View File

@ -837,12 +837,13 @@ class BaseAppTests:
install(session_browser, self.app_name)
@pytest.fixture(autouse=True, scope='class', name='disable_after_tests')
def fixture_disable_after_tests(self, session_browser):
@classmethod
def fixture_disable_after_tests(cls, session_browser):
"""Disable the app after running tests."""
yield
if self.disable_after_tests and is_installed(session_browser,
self.app_name):
app_disable(session_browser, self.app_name)
if cls.disable_after_tests and is_installed(session_browser,
cls.app_name):
app_disable(session_browser, cls.app_name)
@pytest.fixture(autouse=True, name='background')
def fixture_background(self, session_browser, disable_after_tests):