From cf804a586aca06be8dad141ef611e263862c568d Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Mon, 25 Jul 2022 01:16:46 +0200 Subject: [PATCH] Add verbosity argument to quicktest Enables verbose output for analysis on what is happening --- quicktest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quicktest.py b/quicktest.py index c5001732..e387be6e 100755 --- a/quicktest.py +++ b/quicktest.py @@ -14,7 +14,7 @@ import os import sys -class QuickDjangoTest(object): +class QuickDjangoTest: """ A quick way to run the Django test suite without a fully-configured project. @@ -78,6 +78,7 @@ class QuickDjangoTest(object): def __init__(self, *args, **kwargs): self.tests = args + self.kwargs = kwargs or {"verbosity": 1} self._tests() def _tests(self): @@ -112,7 +113,7 @@ class QuickDjangoTest(object): ) from django.test.runner import DiscoverRunner - test_runner = DiscoverRunner(verbosity=1) + test_runner = DiscoverRunner(verbosity=self.kwargs["verbosity"]) django.setup() failures = test_runner.run_tests(self.tests) @@ -134,7 +135,8 @@ if __name__ == '__main__': description="Run Django tests." ) parser.add_argument('tests', nargs="*", type=str) + parser.add_argument("--verbosity", "-v", nargs="?", type=int, default=1) args = parser.parse_args() if not args.tests: args.tests = ['helpdesk'] - QuickDjangoTest(*args.tests) + QuickDjangoTest(*args.tests, verbosity=args.verbosity)