#27255: Change test runner to display full dotted name of test
-----------------------------------+--------------------
     Reporter:  Chris Jerdonek     |      Owner:  nobody
         Type:  Uncategorized      |     Status:  new
    Component:  Testing framework  |    Version:  master
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 At least twice in the past (#26659 and #23332), it has been suggested to
 change Django's test runner to display the full dotted name of tests in
 test output, for example:

 {{{
 FAIL: test_runner.test_discover_runner.DiscoverRunnerTest.test_output
 }}}

 instead of:

 {{{
 FAIL: test_output (test_runner.test_discover_runner.DiscoverRunnerTest)
 }}}

 The reasoning is that this is more convenient for developers: a failing
 test could be rerun simply by copying and pasting the test name directly
 from the test output, as is.

 Previously, in #23332, this suggestion was closed with the following
 reasoning:

 > Django uses the built-in unittest library of Python, and the test output
 is entirely handled by unittest. So there is nothing in Django which could
 be changed to modify this output.

 However, I don't think this summary is accurate because unittest makes it
 very easy to change the test output (I would even say it facilitates
 this), for example by exposing various subclass hooks on its test runner
 and friends. Django indeed is
 
[https://github.com/django/django/blob/b5aac66b28c615b2bda63548cbd695dbb5a0c381/django/test/runner.py#L541
 already doing this] and modifying the test output in certain cases using
 `DebugSQLTextTestResult`. Django also customizes `unittest`'s test running
 in other ways.

 The customizability of test output is also supported by the
 [http://bugs.python.org/issue22431#msg230957 following comment] by the
 author of `unittest`, Michael Foord, in response to a request that this
 change be made in unittest itself:

 > I agree with Robert that the text output of the default runner should
 not be considered a part of the "api" that we make backwards compatible
 guarantees about. People who want to customise that should be customising
 the text runner/result.

 I hope you can reconsider. I put together a patch with tests and will
 submit a PR shortly. You will see that the change is non-intrusive and
 uses the customizability exposed by unittest.

--
Ticket URL: <https://code.djangoproject.com/ticket/27255>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.d6914ae0208aad847c48de0364349c1a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to