#26981: Support passing custom kwargs to DiscoverRunner's test runner
-----------------------------------+--------------------
     Reporter:  cjerdonek          |      Owner:  nobody
         Type:  Uncategorized      |     Status:  new
    Component:  Testing framework  |    Version:  1.9
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 Currently, there doesn't seem to be a nice way to have Django pass custom
 kwargs to the underlying unittest test runner when running tests.

 This is because Django hard-codes the kwargs it passes (see
 
[https://github.com/django/django/blob/013ee21cf8e1a4b05589c161039f244e356272ba/django/test/runner.py#L505
 here] for a direct link to the code):

 {{{#!python
 def run_suite(self, suite, **kwargs):
     resultclass = self.get_resultclass()
     return self.test_runner(
         verbosity=self.verbosity,
         failfast=self.failfast,
         resultclass=resultclass,
     ).run(suite)
 }}}

 Django's default test runner is `unittest.TextTestRunner`, and here are
 all of the kwargs that the runner currently supports (from the function
 signature in Python 3.5.2):

 {{{#!python
 class TextTestRunner(object):

     def __init__(self, stream=None, descriptions=True, verbosity=1,
                  failfast=False, buffer=False, resultclass=None,
 warnings=None,
                  *, tb_locals=False):
 }}}

 One approach to this ticket might involve having `run_suite()` pass its
 kwargs along to the test runner function (instead of "swallowing" them),
 and making whatever other code changes are needed to support this (e.g.
 modifying `run_tests()` to pass kwargs along to `run_suite()`). More
 focused approaches are also possible.

--
Ticket URL: <https://code.djangoproject.com/ticket/26981>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.7ed2363377c34e2427a36a66068a76b0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to