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.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Also, to ground this in reality, the use case I am / was interested in is
passing a custom `stream` to the underlying `TextTestRunner`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:1>
* owner: nobody => cjerdonek
* status: new => assigned
* version: 1.9 => master
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:2>
Comment (by cjerdonek):
I started working on this in branch
[https://github.com/cjerdonek/django/tree/ticket_26981 ticket_26981] of my
GitHub repo.
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:3>
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:4>
* has_patch: 0 => 1
Comment:
I posted a pull request for this in my GitHub repo
[https://github.com/django/django/pull/7009 here].
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ebed9ee8d5e4268d9393261633b2c23cffd426fc" ebed9ee8]:
{{{
#!CommitTicketReference repository=""
revision="ebed9ee8d5e4268d9393261633b2c23cffd426fc"
Fixed #26981 -- Added DiscoverRunner.get_test_runner_kwargs().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26981#comment:6>