Opened 15 years ago

Closed 14 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)

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 Ramiro Morales)

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.

Attachments (2)

tests_specify_module.diff (4.5 KB ) - added by dolapo 15 years ago.
testpackage.diff (1.8 KB ) - added by mapleoin 15 years ago.
documentation patch

Download all attachments as: .zip

Change History (7)

by dolapo, 15 years ago

Attachment: tests_specify_module.diff added

comment:1 by dolapo, 15 years ago

Owner: changed from nobody to dolapo
Status: newassigned

Since I screwed up the formatting in the description, this patch adds to the simple test runner the ability to run tests as:

app.module.TestCase.test_method
app.module.TestCase.*

comment:2 by mapleoin, 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.

by mapleoin, 15 years ago

Attachment: testpackage.diff added

documentation patch

comment:3 by Eric Holscher, 15 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Matt McClanahan, 14 years ago

Severity: Normal
Type: Cleanup/optimization

comment:5 by Ramiro Morales, 14 years ago

Description: modified (diff)
Easy pickings: unset
Resolution: duplicate
Status: assignedclosed
UI/UX: unset

Duplicate of #6712.

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