[Django] #26659: New parameter for test methods filtering

5 views
Skip to first unread message

Django

unread,
May 24, 2016, 4:04:37 PM5/24/16
to django-...@googlegroups.com
#26659: New parameter for test methods filtering
-------------------------------+--------------------
Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords: tests
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
As described here:
https://groups.google.com/d/msg/django-developers/W6YiFg9ITg0/BAOTHezHBgAJ

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.

Django

unread,
May 24, 2016, 4:04:52 PM5/24/16
to django-...@googlegroups.com
#26659: New parameter for test methods filtering
---------------------------+----------------------------

Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution:

Keywords: tests | Triage Stage: Unreviewed
Has patch: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------+----------------------------
Changes (by apiraino):

* Attachment "patch.diff" added.

Django

unread,
May 24, 2016, 4:10:41 PM5/24/16
to django-...@googlegroups.com
#26659: New parameter for test methods filtering
-------------------------------+--------------------------------------

Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution:

Keywords: tests | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by apiraino):

* needs_docs: => 1
* needs_tests: => 0
* easy: 0 => 1
* needs_better_patch: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:1>

Django

unread,
May 26, 2016, 3:09:48 PM5/26/16
to django-...@googlegroups.com
#26659: New parameter for test methods filtering
-------------------------------------+-------------------------------------

Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 1.9

Severity: Normal | Resolution:
Keywords: tests | Triage Stage:
| Someday/Maybe

Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
May 26, 2016, 3:11:00 PM5/26/16
to django-...@googlegroups.com
#26659: Allow filtering of which tests run
-------------------------------------+-------------------------------------

Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:
Keywords: tests | Triage Stage:
| Someday/Maybe
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/26659#comment:3>

Django

unread,
Jun 3, 2016, 3:19:23 PM6/3/16
to django-...@googlegroups.com
#26659: Allow filtering of which tests run
-------------------------------------+-------------------------------------
Reporter: apiraino | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:
Keywords: tests | Triage Stage:
| Someday/Maybe
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Django

unread,
Dec 1, 2019, 1:38:31 PM12/1/19
to django-...@googlegroups.com
#26659: Allow filtering of which tests run
-------------------------------------+-------------------------------------
Reporter: Antonio Piraino | Owner: nobody
Type: New feature | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: duplicate

Keywords: tests | Triage Stage:
| Someday/Maybe
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

* 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>

Reply all
Reply to author
Forward
0 new messages