Pay attention to doctests

Bug #1118173 reported by Marius Gedminas
6
This bug affects 1 person
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_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

Related branches

Florent (florent.x)
Changed in pyflakes:
importance: Undecided → Wishlist
Revision history for this message
Florent (florent.x) wrote :

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.

Revision history for this message
Florent (florent.x) wrote :

Merged for 0.7

Changed in pyflakes:
milestone: none → 0.7
status: New → Fix Committed
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Thanks!

Florent (florent.x)
Changed in pyflakes:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.