Opened 13 years ago
Closed 11 years ago
#16534 closed Cleanup/optimization (fixed)
DiscoverRunner API makes re-use difficult.
Reported by: | Tom Christie | Owned by: | Cliff Dyer |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | andy@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Would be better if it allowed the test suite class and test runner class to be overridden.
Attachments (6)
Change History (24)
by , 13 years ago
Attachment: | djangotestsuiterunner.diff added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Sounds like a reasonable idea.
comment:3 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 13 years ago
Attachment: | djangotestsuiterunner-2.diff added |
---|
Also allow test_runner to be overridden
comment:5 by , 13 years ago
Cc: | added |
---|---|
Needs documentation: | unset |
Needs tests: | unset |
Don't think this needs documentation - it's an internal interface, and don't think it needs tests as it's clean-up, not new functionality.
follow-up: 8 comment:7 by , 13 years ago
Needs documentation: | set |
---|
DjangotestSuiteRunner is documented, changes introduced for this ticket also need documentation.
comment:8 by , 13 years ago
Replying to ramiro:
DjangotestSuiteRunner is documented, changes introduced for this ticket also need documentation.
Ah, true. I'll get that sorted, then...
comment:9 by , 12 years ago
Don't know how this patch applies given 1.6's incoming test runner changes, if anyone's picking this up at DjangoCon, that'd need investigation first...
comment:11 by , 11 years ago
So it doesn't apply as is. I've modified to to work with the new subclassing of DiscoverRunner. All tests still pass. I'm looking into the documentation situation, and then I'll be uploading a patch.
by , 11 years ago
Attachment: | djangotestsuiterunner-3.diff added |
---|
New patch that works with DiscoverRunner instead of DjangoTestSuiteRunner
comment:12 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Looking more closely, DjangoTestSuiteRunner is deprecated. Updating it seems like the wrong way to move forward. Instead, we should ensure that the new hotness (DiscoverRunner) contains the requested features.
It already allows overriding test_loader. Following the example in previous patches, I have updated DiscoverRunner to allow overriding the test suite and the unittest-level test runner (TextTestRunner). I have also updated the documentation of DiscoverRunner at topics/testing/advanced/ to detail these attributes.
In a small departure from earlier patches, I have taken the liberty of renaming suite_class to test_suite (for consistency with test_runner and test_loader). Because it is pending deprecation, no enhancements have been made to django.test.simple or the DjangoTestSuiteRunner.
comment:13 by , 11 years ago
Needs documentation: | unset |
---|
by , 11 years ago
Attachment: | djangotestsuiterunner-4.diff added |
---|
Added documentation updates suggested on IRC by timograham
comment:14 by , 11 years ago
Version: | 1.3 → master |
---|
comment:15 by , 11 years ago
Summary: | DjangoTestSuiteRunner API makes re-use difficult. → DiscoverRunner API makes re-use difficult. |
---|
Changed the ticket title to reflect the new direction of the ticket.
by , 11 years ago
Attachment: | djangotestsuiterunner-4.diff added |
---|
Added documentation updates suggested on IRC by timograham (edited to fix a documentation typo: DicsoverRunner)
by , 11 years ago
Attachment: | discoverrunner-with-tests.diff added |
---|
One last attachment, this one with tests.
comment:16 by , 11 years ago
I added tests. They're pretty brain dead, because the entire change was an attribute creation refactor, but now that the attributes are documented, we want to be notified if they go away or become the wrong thing.
comment:17 by , 11 years ago
Created a ticket to track backporting some documentation changes to 1.6.
comment:18 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
NB: Note the same pattern in unittest2 - http://hg.python.org/unittest2/file/d2be68aedc8e/unittest2/runner.py#l129