#18727 closed Cleanup/optimization (fixed)
Remove django.test._doctest
Reported by: | Aymeric Augustin | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
We have copied this module from the standard library and submitted the patch to Python's bug tracker six years ago: http://bugs.python.org/issue1521051
Unfortunately the ticket is stuck because the patch didn't include tests. Even if tests were added and the patch was committed now, we'd have to deprecate all Pythons <= 3.3 before removing our copy and relying on the stdlib. This isn't going to happen in the next five years.
Patching our copy to support both Python 2 and 3 increases severely the amount of changes from Python's version. It becomes much harder to apply upstream changes. We could copy both the version from 2.7 and the version from 3.2, apply the patch to both, and import the right one, but that adds complexity.
I think we'd better deprecate our copy:
- doctests aren't a suitable tool for testing Django apps (IMO),
- we moved away from using doctests in Django's test suite,
- Russell suggested it two years ago in the tickets comments.
Change History (8)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
comment:2 by , 12 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:3 by , 12 years ago
Triage Stage: | Design decision needed → Accepted |
---|
Let's do this with #17365 then.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 12 years ago
Closing this ticket, as django.test._doctest
has now been deprecated and will be removed on the normal deprecation schedule.
I'm the author of that ticket, and the person responsible for there being no tests. If I'd finished the job in 2006, it would have been a non-issue, but as it is, we have a headache.
However, we need to be clear about what it is we'd be deprecating -- it's not just removing our copy of doctests, we'd be deprecating the ability for Django's test runner to identify and include doctests. The reason the modified doctest package exists is for integration with our test runner; if we remove the duplicate package, we lose the features we need to integrate with the test runner.
Since the doctest-ocalypse, this isn't an issue for Django itself; however, I can imagine that it may be problematic for some users.
Personally, I have no problems killing doctests in this way. I'm sure others share my enthusiasm. I'm also sure that some do not.
Another way to tackle this problem -- make it part of #17365. If we change our test discovery mechanism to be something standardized, we can fall back on the standardized behaviour, which won't include doctests by default.