mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-12 12:26:04 +00:00
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:
parent
c1aeb1f661
commit
d2a959a277
@ -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')
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user