we could add a new, optional parameter to filter only a desired set of
(comma separated) test methods instead of writing the full path for a
single test or run an entire class/package. Example, instead of this:
$ python manage.py test \
mydjangoapp.app_one.tests.test_module.TestClass.test_method_1
we could have this:
$ python manage.py test --method-filter test_method_1,test_method_2,...
Another improvement this patch implements (as suggested in that django-dev
thread) is the possibility to have the full path to the failing test to be
easily copied and pasted. This is implemented adding a
SimpleTextTestResult class.
These are especially useful for running only failing tests.
If the ticket is accepted, I'll write the documentation too.
--
Ticket URL: <https://code.djangoproject.com/ticket/26659>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "patch.diff" added.
* needs_docs: => 1
* needs_tests: => 0
* easy: 0 => 1
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:1>
* needs_better_patch: 0 => 1
* component: Uncategorized => Testing framework
* easy: 1 => 0
* stage: Unreviewed => Someday/Maybe
Comment:
I'm more convinced by [https://groups.google.com/d/msg/django-
developers/W6YiFg9ITg0/Uk8U7D3JBgAJ Josh's proposal] on the mailing list
thread about the possibility of using glob-style patterns. Perhaps adding
a new parameter to the test runner isn't needed. I'd also like to see if
any other testing tools implement something similar. The problem this
ticket aims to address doesn't seem Django specific.
The change in the output format was proposed in #23332. Perhaps you could
try addressing [http://bugs.python.org/issue22431 the Python issue]
spawned by that ticket. We might consider reopening the Django ticket in
light of your solution if the issue cannot be addressed upstream. For
future reference, please don't combined multiple features in a single
ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:3>
Comment (by tbeadle):
py.test gives you the ability to select tests by
1) full path (test ID)
2) using a "-k <value>" command-line option to select tests that include
<value> in the name/path
3) passing --lf to run the tests that failed during the last run
--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:4>
* status: new => closed
* resolution: => duplicate
Comment:
Correct me if I'm wrong, but I'm going to mark this as a duplicate of
#30245 which implemented unittest's `-k` option [1].
I think is pretty close to what the original report was asking for since
you can now write something like `$ python manage.py test -k
test_method_*`.
[1] https://docs.python.org/3/library/unittest.html#cmdoption-unittest-k
--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:5>