Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay attention to doctests #155

Closed
pyflakes-bot opened this issue Feb 7, 2013 · 3 comments
Closed

Pay attention to doctests #155

pyflakes-bot opened this issue Feb 7, 2013 · 3 comments

Comments

@pyflakes-bot
Copy link

Original report by mgedmin (@mgedmin?) on Launchpad:


A lot of Zope packages use the following style for their unit tests:

import doctest

from somepackage import something

def doctest_something_does_it_right():
    """

        >>> something('the ultimate answer')
        42

    """

def test_suite():
    return doctest.DocTestSuite()

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://code.launchpad.net/~pyflakes-dev/pyflakes/0.6-doctest-support

@pyflakes-bot
Copy link
Author

Original comment by florent.x (@florentx?) on Launchpad:


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.
https://code.launchpad.net/~pyflakes-dev/pyflakes/0.6-col-offset/+merge/156231

The branch related to the doctest-support needs update.

@pyflakes-bot
Copy link
Author

Original comment by florent.x (@florentx?) on Launchpad:


Merged for 0.7

@pyflakes-bot
Copy link
Author

Original comment by mgedmin (@mgedmin?) on Launchpad:


Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant