#8363: Make it possible to specify tests to skip when running runtests.py
---------------------------------------+-----------------------------------
Reporter: ramiro | Owner: ramiro
Type: New feature | Status: new
Milestone: 1.3 | Component: Testing framework
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-----------------------------------
Changes (by julien):
* ui_ux: => 0
Comment:
So I've spent a bit of time working on this. The attached patch implements
full support for the `--exclude` option both for the `test` and `runtests`
commands. To do so I've had to refactor the `DjangoTestSuiteRunner` quite
heavily following an approach that one may not find appropriate, so I'd
welcome some feedback.
In a nutshell, the suggested approach is to generate a one-level-deep
dictionary: label->test, where label is a full string reference to a test
(of the form app.TestClass.test_method) and test is either a test case or
a doctest instance. For example:
{{{#!python
{
'auth.AnonymousUserBackendTest.test_get_all_permissions':
<django.contrib.auth.tests.auth_backends.AnonymousUserBackendTest
testMethod=test_get_all_permissions>,
'auth.AnonymousUserBackendTest.test_has_module_perms':
<django.contrib.auth.tests.auth_backends.AnonymousUserBackendTest
testMethod=test_has_module_perms>,
...
}
}}}
This then makes it trivial to exclude some given tests before running the
test suite by removing the dictionary items corresponding to the excluded
tests' labels. However, there is a concern: using this flat structure
means that some information may get lost in the process (e.g. the nesting
of the various sub-suite instances) which may potentially introduce some
annoying limitations in the future.
By the way, about 13 tests out of 4065 don't seem to be run after this
patch. I need to narrow down the cause of this. Another note: it seems
bizarre that, even in trunk, both `unittest.TestLoader` and
`unittest.defaultTestLoader` are used in `simple.py`.
--
Ticket URL: <https://code.djangoproject.com/ticket/8363#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.