From 195e4a6c8b0c7d24920e1a19e9b27233488b0131 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 9 Jul 2023 18:31:42 +0200 Subject: [PATCH] Fix runner-options argument on Django test runner (#221) --- app_helper/main.py | 2 ++ app_helper/server.py | 1 + changes/220.bugfix | 1 + tests/test_commands.py | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changes/220.bugfix diff --git a/app_helper/main.py b/app_helper/main.py index b7de06c..a714eec 100644 --- a/app_helper/main.py +++ b/app_helper/main.py @@ -84,6 +84,8 @@ def _test_run_worker(test_labels, test_runner, failfast=False, runner_options=No if "PytestTestRunner" in test_runner: kwargs["pytest_args"] = runner_options else: + if not isinstance(runner_options, list): + runner_options = runner_options.split(" ") extra = _parse_runner_options(TestRunner, runner_options) extra.update(kwargs) kwargs = extra diff --git a/app_helper/server.py b/app_helper/server.py index 86bfadb..590a6c9 100644 --- a/app_helper/server.py +++ b/app_helper/server.py @@ -48,6 +48,7 @@ def _init_runserver(runserver_module, bind, port, verbose, logger=None, channels "use_static_handler": True, "use_threading": True, "verbosity": verbose, + "skip_checks": True, "use_reloader": True, }, ) diff --git a/changes/220.bugfix b/changes/220.bugfix new file mode 100644 index 0000000..7cdccf8 --- /dev/null +++ b/changes/220.bugfix @@ -0,0 +1 @@ +Fix runner-options argument on Django test runner diff --git a/tests/test_commands.py b/tests/test_commands.py index 2eb1efa..c0e4193 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -604,7 +604,7 @@ def test_testrun_runner_options(self): args["--persistent"] = True args["--runner"] = "runners.CapturedOutputRunner" args[""] = self.application - args["--runner-options"] = ["--tag=a-tag"] + args["--runner-options"] = "--tag=a-tag" core(args, self.application) self.assertTrue("Ran 1 test in" in err.getvalue()) self.assertEqual(exit_state.exception.code, 0)