tor: tests: Fix issue with pytest 8.x versions

Closes: https://bugs.debian.org/1063968.

- Due to a changed behavior in pytest 8.x, any imports with 'setup_module' name
will be treated as a method to setup the module in the style of unittest/nose.
pytest tries to call this as a method and will fail.

- Rename the import to 'setup_module_' instead of 'setup_module' to fix this issue.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-02-15 10:28:50 -08:00 committed by James Valleroy
parent 71a10bfd31
commit 37b9e21e30
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -10,7 +10,7 @@ from django.utils.translation import gettext_noop
from plinth import action_utils
from plinth import app as app_module
from plinth import cfg, kvstore, menu
from plinth import setup as setup_module
from plinth import setup as setup_module_ # Not setup_module, for pytest
from plinth.daemon import (Daemon, app_is_running, diagnose_netcat,
diagnose_port_listening)
from plinth.modules import torproxy
@ -209,7 +209,7 @@ class TorApp(app_module.App):
kvstore.set(torproxy.PREINSTALL_CONFIG_KEY, json.dumps(config))
# This creates the operation, which will run after the current
# operation (Tor setup) is completed.
setup_module.run_setup_on_app('torproxy')
setup_module_.run_setup_on_app('torproxy')
if not old_version:
logger.info('Enabling Tor app')