diff --git a/tests/test_jobs.py b/tests/test_jobs.py index 56651ab..7b6ea5d 100644 --- a/tests/test_jobs.py +++ b/tests/test_jobs.py @@ -16,16 +16,9 @@ class JobsTests(unittest.TestCase): config = tutor_config.load_full(root) runner = context.job_runner(config) jobs.initialise(runner) - output = mock_stdout.getvalue().strip() - service = re.search(r"Service: (\w*)", output) - commands = re.search(r"(-----)([\S\s]+)(-----)", output) - assert service is not None - assert commands is not None self.assertTrue(output.startswith("Initialising all services...")) self.assertTrue(output.endswith("All services initialised.")) - self.assertEqual(service.group(1), "mysql") - self.assertTrue(commands.group(2)) def test_create_user_command_without_staff(self) -> None: command = jobs.create_user_command("superuser", False, "username", "email") diff --git a/tutor/commands/cli.py b/tutor/commands/cli.py index cb72369..444316f 100755 --- a/tutor/commands/cli.py +++ b/tutor/commands/cli.py @@ -14,12 +14,13 @@ from tutor.commands.k8s import k8s from tutor.commands.local import local from tutor.commands.plugins import plugins_command -# Everyone on board -hooks.Actions.CORE_READY.do() - def main() -> None: try: + # Everyone on board + # Note that this action should not be triggered in the module scope, because it + # makes it difficult for tests to rollback changes. + hooks.Actions.CORE_READY.do() cli() # pylint: disable=no-value-for-parameter except KeyboardInterrupt: pass diff --git a/tutor/plugins/v1.py b/tutor/plugins/v1.py index 6004a5a..ec0f9ac 100644 --- a/tutor/plugins/v1.py +++ b/tutor/plugins/v1.py @@ -25,8 +25,9 @@ def _discover_entrypoint_plugins() -> None: Discover all plugins that declare a "tutor.plugin.v1" entrypoint. """ with hooks.Contexts.PLUGINS.enter(): - for entrypoint in pkg_resources.iter_entry_points("tutor.plugin.v1"): - discover_package(entrypoint) + if "TUTOR_IGNORE_ENTRYPOINT_PLUGINS" not in os.environ: + for entrypoint in pkg_resources.iter_entry_points("tutor.plugin.v1"): + discover_package(entrypoint) def discover_module(path: str) -> None: