diff --git a/plinth/tests/runtests.py b/plinth/tests/runtests.py index 7a8e8ad91..b33edd70e 100644 --- a/plinth/tests/runtests.py +++ b/plinth/tests/runtests.py @@ -33,8 +33,8 @@ def run_tests(pattern=None, return_to_caller=False): os.environ['DJANGO_SETTINGS_MODULE'] = \ 'plinth.tests.data.django_test_settings' django.setup() - TestRunner = get_runner(settings) - test_runner = TestRunner() + test_runner_cls = get_runner(settings) + test_runner = test_runner_cls() if pattern is None: pattern_list = [ @@ -48,5 +48,6 @@ def run_tests(pattern=None, return_to_caller=False): if failures > 0 or not return_to_caller: sys.exit(bool(failures)) + if __name__ == '__main__': run_tests() diff --git a/plinth/tests/test_actions.py b/plinth/tests/test_actions.py index 85b139fb1..8cc46ff46 100644 --- a/plinth/tests/test_actions.py +++ b/plinth/tests/test_actions.py @@ -28,8 +28,8 @@ from plinth import cfg test_dir = os.path.split(__file__)[0] -root_dir = os.path.abspath(os.path.join(test_dir, os.path.pardir + os.path.sep + - os.path.pardir)) +root_dir = os.path.abspath(os.path.join(test_dir, os.path.pardir + + os.path.sep + os.path.pardir)) cfg.actions_dir = os.path.join(root_dir, 'actions') @@ -53,7 +53,7 @@ class TestPrivileged(unittest.TestCase): def notest_run_as_root(self): """1. Privileged actions run as root. """ self.assertEqual( - '0', # user 0 is root + '0', # user 0 is root superuser_run('id', ['-ur'])[0].strip()) def test_breakout_actions_dir(self): @@ -114,7 +114,8 @@ class TestPrivileged(unittest.TestCase): def test_breakout_option_list(self): """3D. Option lists can't be used to run other actions. - Verify that shell control characters aren't interpreted in option lists. + Verify that shell control characters aren't interpreted in + option lists. """ option_lists = ((';', 'echo', 'hello'), ('&&', 'echo', 'hello'),