Pay attention to doctests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
A lot of Zope packages use the following style for their unit tests:
import doctest
from somepackage import something
def doctest_
"""
>>> something('the ultimate answer')
42
"""
def test_suite():
return doctest.
Since pyflakes doesn't pay attention to doctests in docstrings, it tends to produce huge amount of false positives ("unused name 'something') and it misses possible issues in the doctest code.
There's an old patch by Ignas Mikalajūnas that adds doctest support to pyflakes. I've been using it for a long time in my fork (lp:~mgedmin/pyflakes/pyflakes-mg). Florent Xicluna recently rebased it on top of the latest pyflakes in https:/
Related branches
- Pyflakes Dev: Pending requested
-
Diff: 331 lines (+233/-3)4 files modifiedNEWS.txt (+1/-0)
pyflakes/checker.py (+45/-3)
pyflakes/messages.py (+8/-0)
pyflakes/test/test_doctests.py (+179/-0)
Changed in pyflakes: | |
importance: | Undecided → Wishlist |
Changed in pyflakes: | |
status: | Fix Committed → Fix Released |
The merge proposal was held back because it would have created conflict with the resolution of bug 1159514
Now the merge proposal for adding column information is merged in trunk. /code.launchpad .net/~pyflakes- dev/pyflakes/ 0.6-col- offset/ +merge/ 156231
https:/
The branch related to the doctest-support needs update.