Opened 15 years ago
Closed 13 years ago
#12191 closed Cleanup/optimization (duplicate)
It's not possible to run a specific test if it's not in models.py or tests.py (e.g. when using suites) — at Version 5
Reported by: | dolapo | Owned by: | dolapo |
---|---|---|---|
Component: | Testing framework | Version: | 1.1 |
Severity: | Normal | Keywords: | testing test |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The simple django test runner looks for tests in either models.py or tests.py. This is unfortunate for large applications since tests.py in each app becomes rather large and unwieldy. Apps with a large number of tests can break out their tests further by creating a method called suite()
that returns a TestSuite
. This works for test separation but because the runner still looks for test cases in models.py or tests.py it is no longer possible to run an individual TestCase
or TestCase.test_method
.
Proposal:
In addition to supporting the ability to specify tests to run as:
app
app.TestCase
app.TestCase.test_method
also support:
app.module.TestCase.test_method
app.module.TestCase.*
I'm including a patch which adds this functionality.
Change History (7)
by , 15 years ago
Attachment: | tests_specify_module.diff added |
---|
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
This looks more like a documentation bug to me, you can replace tests.py
with a tests
python package and you can have as many submodules as you want in different files in that package as explained in the Python docs.
I'm attaching a documentation patch.
comment:3 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Cleanup/optimization |
comment:5 by , 13 years ago
Description: | modified (diff) |
---|---|
Easy pickings: | unset |
Resolution: | → duplicate |
Status: | assigned → closed |
UI/UX: | unset |
Duplicate of #6712.
Since I screwed up the formatting in the description, this patch adds to the simple test runner the ability to run tests as: