This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Change format of test runner output
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Tim.Graham, ZackerySpytz, googol, jdufresne, martin.panter, michael.foord, pitrou, r.david.murray, rbcollins
Priority: normal Keywords: patch

Created on 2014-09-17 13:44 by googol, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 21609 open ZackerySpytz, 2020-07-24 23:58
Messages (10)
msg227000 - (view) Author: Philipp Metzler (googol) Date: 2014-09-17 13:44
Can I change the test runner output format to
main.tests.tests.TimeSlotTestCase.test_creation ... ERROR
instead of
test_creation (main.tests.tests.TimeSlotTestCase) ... ERROR
so that I can easily just copy&paste that line and run the test again without having to remove the brackets () and having to copy the name of the test behind the class and add a .?
msg227001 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-09-17 13:58
I remember this feature being requested before (I vote +1 myself :), and I believe I recall a conversation involving Michael Foord where he approved it in principle, but I can't find an open issue for it.  As a new feature it can only go into 3.5, and would presumably need to be controlled by an option somewhere to preserve backward compatibility with things that parse unittest output.

If you want to work on a patch that would be welcome.
msg230801 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-11-07 12:34
I don't consider the console output of unittest to be a stable interface. Michael - do you?

Things that want to process unittest should be using the API.
msg230802 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-11-07 12:39
I agree with Robert. However, since software authors' wishes can clearly be diverse here, perhaps there should be a simple way for them to customize the output?
msg230957 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-11-10 11:59
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. (Unfortunately it requires tinkering with both at the moment.)
msg231100 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-11-13 10:21
Yes, making customising the output easier is a good thing. One way is to use e.g. (which can work with all unittest versions since 2.6) and write a custom filter. Or a custom TestResult and TextTestRunner can work too :)
msg277081 - (view) Author: Tim Graham (Tim.Graham) * Date: 2016-09-21 00:20
Is there opposition to changing the default output as outlined in the first comment? If so, then I think this ticket should be closed or retitled to reflect the intent.
msg277082 - (view) Author: Tim Graham (Tim.Graham) * Date: 2016-09-21 00:23
Here's the patch if we make the change in Django instead:
msg277083 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-09-21 00:43
My understanding of the comments is that the change to the default is OK (in a feature release, at least).
msg277084 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2016-09-21 01:03
+1 to changing the UI for 3.7 - just noting that if you're machine processing the output, the TUI isn't an appropriate channel.
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66621
2020-07-24 23:58:19ZackerySpytzsetkeywords: + patch
nosy: + ZackerySpytz

pull_requests: + pull_request20751
stage: patch review
2016-10-19 22:04:28jdufresnesetnosy: + jdufresne
2016-09-21 01:03:31rbcollinssetmessages: + msg277084
2016-09-21 00:43:03r.david.murraysetmessages: + msg277083
versions: + Python 3.7, - Python 3.5
2016-09-21 00:23:15Tim.Grahamsetmessages: + msg277082
2016-09-21 00:20:24Tim.Grahamsetnosy: + Tim.Graham
messages: + msg277081
2014-11-13 10:21:29rbcollinssetmessages: + msg231100
2014-11-10 11:59:20michael.foordsetmessages: + msg230957
2014-11-07 12:39:33pitrousetnosy: + pitrou
messages: + msg230802
2014-11-07 12:34:34rbcollinssetnosy: + rbcollins
messages: + msg230801
2014-09-17 23:08:48martin.pantersetnosy: + martin.panter
2014-09-17 13:58:04r.david.murraysetversions: + Python 3.5, - Python 2.7
nosy: + r.david.murray, michael.foord

messages: + msg227001

components: + Library (Lib), - Tests
2014-09-17 13:44:38googolcreate