From 37b9e21e3058732c12bdf447cc1db2e74ea2495f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 15 Feb 2024 10:28:50 -0800 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/modules/tor/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index dfc8c48de..541ff9e92 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -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')