Opened 7 years ago

Closed 4 years ago

#12141 closed New feature (wontfix)

Add glob support to tests/runtests.py

Reported by: Johannes Dollinger Owned by: Eric Holscher
Component: Testing framework Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Glob support for the app labels passed to runtests.py:

$ python tests/runtests.py "m2*"
Selected 9 tests: m2m_and_m2o, m2m_intermediary, m2m_multiple, m2m_recursive, m2m_through, m2o_recursive, m2o_recursive2, m2m_regress, m2m_through_regress
----------------------------------------------------------------------
Ran 9 tests in 0.823s

OK
$ python tests/runtests.py basic "m2*"
Selected 10 tests: basic, m2m_and_m2o, m2m_intermediary, m2m_multiple, m2m_recursive, m2m_through, m2o_recursive, m2o_recursive2, m2m_regress, 
m2m_through_regress
----------------------------------------------------------------------
Ran 10 tests in 0.849s

OK
$ python tests/runtests.py "modeltests/*"
Selected 56 tests: aggregation, basic, choices, custom_columns, custom_managers, custom_methods, custom_pk, defer, delete, empty, expressions, 
field_defaults, field_subclassing, files, fixtures, force_insert_update, generic_relations, get_latest, get_object_or_404, get_or_create, 
invalid_models, lookup, m2m_and_m2o, m2m_intermediary, m2m_multiple, m2m_recursive, m2m_through, m2o_recursive, m2o_recursive2, many_to_many, 
many_to_one, many_to_one_null, model_forms, model_formsets, model_inheritance, mutually_referential, on_delete, one_to_one, or_lookups, 
order_with_respect_to, ordering, pagination, properties, proxy_models, reserved_names, reverse_lookup, save_delete_hooks, select_related, 
serializers, signals, str, test_client, transactions, unmanaged_models, update, user_commands
----------------------------------------------------------------------
Ran 99 tests in 22.371s

OK
$ python tests/runtests.py "modeltests/m*" templates "custom*"
Selected 21 tests: m2m_and_m2o, m2m_intermediary, m2m_multiple, m2m_recursive, m2m_through, m2o_recursive, m2o_recursive2, many_to_many, 
many_to_one, many_to_one_null, model_forms, model_formsets, model_inheritance, mutually_referential, templates, custom_columns, 
custom_managers, custom_methods, custom_pk, custom_columns_regress, custom_managers_regress
----------------------------------------------------------------------
Ran 35 tests in 2.151s

OK
$ 

Of course this doesn't have to be in runtests.py. But I really like my wrapper script, so here's a patch.

Attachments (1)

12141.runtests_glob.diff (2.0 KB) - added by Johannes Dollinger 7 years ago.

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by Johannes Dollinger

Attachment: 12141.runtests_glob.diff added

comment:1 Changed 7 years ago by Eric Holscher

Needs documentation: set
Needs tests: set
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Sounds great. Needs some docs/tests to go along with it.

comment:2 Changed 6 years ago by Eric Holscher

milestone: 1.3
Owner: changed from nobody to Eric Holscher
Status: newassigned

comment:3 Changed 6 years ago by Ramiro Morales

Description: modified (diff)

(Changed WikiFormatting processor in description code block from bash to sh so it is visible with new Trac 0.12)

comment:4 Changed 5 years ago by Matt McClanahan

Severity: Normal
Type: New feature

comment:5 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

comment:11 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 Changed 4 years ago by Aymeric Augustin

Resolution: wontfix
Status: assignedclosed

In 2013, developing a custom test runner for Django doesn't seem like a good idea any more. Maintaining a test runner is hard and Django doesn't have any specificities that would justify it.

I'm closing this ticket in favor of #17365 which suggests using standard test discovery.

Note: See TracTickets for help on using tickets.
Back to Top