request to reopen issue #23332 (using the dotted test name in test output)

79 views
Skip to first unread message

Chris Jerdonek

unread,
Sep 20, 2016, 8:16:27 PM9/20/16
to Django developers (Contributions to Django itself)
Hi, I would like to reopen the following issue from two years ago to change the test name in Django's test output from unittest's default to the full "dotted name":


This would make rerunning failing tests easier because then the test name could simply be copy and pasted from the command-line as is.

Tim told me that to reopen the issue, it needed to be discussed on this list first and consensus reached. See Tim's comment (as well as some of my reasoning for why I think the issue should be reopened) here:


I put together a patch here with tests so you can see the PR that I was planning to propose:


The approach is simply to subclass unittest.TextTestResult and override its getDescription() method to use the dotted name instead of unittest's current, less helpful format. Django already has an example of subclassing TextTestResult with its DebugSQLTextTestResult class.

Thanks,
--Chris

Tim Graham

unread,
Sep 20, 2016, 8:28:46 PM9/20/16
to Django developers (Contributions to Django itself)
I updated the Python issue to ask whether or not there's consensus to make the change there. Even if that issue proceeds, I guess it would be a nice convenience for current versions of Python that won't receive the change.
http://bugs.python.org/issue22431

Yoong Kang Lim

unread,
Sep 20, 2016, 8:29:03 PM9/20/16
to django-d...@googlegroups.com
Hmm if we're going down that path, I'd prefer to be more explicit about it. How about including the exact command that people can copy to re-run the failed test?

This is what the RSpec library (a Ruby testing library) does, and IMO it really gets it right. 

See this blog post here from a Ruby core member for some comments (under "things I like about RSpec", and yes, that's the actual domain name): 


Thoughts?



--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5ab3f23b-04c0-455e-8f33-7502e14f9fe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Jerdonek

unread,
Sep 21, 2016, 5:24:54 AM9/21/16
to Django developers (Contributions to Django itself)
On Tuesday, September 20, 2016 at 5:28:46 PM UTC-7, Tim Graham wrote:
I updated the Python issue to ask whether or not there's consensus to make the change there. Even if that issue proceeds, I guess it would be a nice convenience for current versions of Python that won't receive the change.
http://bugs.python.org/issue22431

Thanks for getting clarification on the Python issue, Tim.

To expand on Tim's latter point, because changing this in Python wouldn't be considered a bug fix in Python, the earliest Python version that could have the change would be 3.7. If the time between 3.6 and 3.7 is the same as the expected time between 3.5 and 3.6 (see [1] and [2] for those schedules), then 3.7 would be released in March 2018. Django users using Python 2.x or 3.6 or lower would never see the change if it's changed in Python alone.

--Chris

Josh Smeaton

unread,
Sep 21, 2016, 9:09:05 PM9/21/16
to Django developers (Contributions to Django itself)
I'd be very happy with a change to give the full dotted path to the test. I've copy/paste/modify/copy/paste hundreds of times, and it has always bothered me. Big +1. Agree with Tim that a push upstream would be good, but I'm all for solving this immediately in Django.

I think the suggestion made by Yoong Kang Lim is probably a marginal improvement over full dotted path, and don't have any strong feelings here other than if you try and it gets really complicated then stop.

Cheers
Reply all
Reply to author
Forward
0 new messages