On 17/05/2016 02:32, Josh Smeaton wrote:
> I have the same problem when running tests in Django's test suite. When
> there's a failure, I have to copy the test path, paste that, then copy
> the failing test.
Now that you mention it, another improvement could be to compose a
ready-to-copy-and-paste "url" for the output of failing tests. Instead of:
====================
ERROR: test_method_1 (mydjangoapp.app_one.tests.test_module.TestClass)
Test docstring
====================
we could tweak printErrorList() into something along the line of:
====================
ERROR: test_method_1 (mydjangoapp.app_one.tests.test_module.TestClass)
Test docstring
url: mydjangoapp.app_one.tests.test_module.TestClass.test_method_1
====================
> Would you mind posting your patch somewhere? Reviewing code along with
> the description and seeing potential for changes would be cool.
Sure, no problem.
http://paste.debian.net/686941/
It's somehow rough, I'm simply adding a new optional parameter to the
Django Command that runs the tests; this parameter will force an
iteration through the test suite and discard those methods whose name is
not specified. I could not directly access the TestSuite objects to
remove an item (which is funny since internally unittest.TestSuite uses
a list).
It could be refactored somewhere else or improved like you suggested,
provided some examples of what kind of globbing/regex you think it would
be useful f.e. glob test methods only? Packages only? A dot separated
syntax to specify both? Etc.
Concerning the suggestion of Ludovic of gathering the failing tests and
re-run them, I agree that a dedicated tool like the juno-testrunner is
better suited for the job.
Thanks for your comments.
Antonio