Tue May 30 15:31:34 2006

Ticket #63 (Closed: fixed)

TypeError: iteration over non-sequence


Priority: normal Reporter: lbruno@republico.estv.ipv.pt
Severity: blocker Assigned to: jpellerin
Component: nose:plugin:doctest Status: closed
Version: 0.9 Resolution: fixed
Milestone: 0.9 Keywords:  

Description by lbruno@republico.estv.ipv.pt:

This exception is thrown when running:

nosetests --with-doctest .

And it's thrown by trying to iterate over the result of DocTest?.py::loadTestsFromPath(), which returns None.

My expectation (although I've only read the code diagonally), is for loadTestsFromModule() to find my doctests, and loadTestsFromPath() to be used for loading doctests from other places. I really haven't understood the purpose of loadTestsFromPath(), have I?

I'll attach a patch right away, but I'm afraid I'm only masking the error somehow; please do look it over to see if that is what's correct.

Attachments

  • nose-doctest.patch (542 bytes) - Return an empty tuple() instead of None when no tests can be loaded, added by lbruno@republico.estv.ipv.pt on Tue May 30 15:32:27 2006.

Changelog

Tue May 30 15:32:27 2006: Modified by lbruno@republico.estv.ipv.pt

  • attachment added: nose-doctest.patch

Tue May 30 15:34:49 2006: Modified by lbruno@republico.estv.ipv.pt

    Another idea is to ensure that whoever calls these plugin functions can handle non-sequences; maybe a wrapper (decorator?) which translates None into an empty tuple(). This would make plugin writers' lives easier, as the API would be less demanding.

    Tue May 30 15:36:42 2006: Modified by guest

    • cc set to lbruno@republico.estv.ipv.pt

    Tue May 30 15:41:53 2006: Modified by lbruno@republico.estv.ipv.pt

    • milestone changed from 0.9a2 to 1.0

    Hadn't spotted the b1 release; changing accordingly. I'm filing the bug report against -r53.

    Thu Jun 1 20:06:23 2006: Modified by jpellerin

    • resolution set to fixed
    • status changed from new to closed

    I'm confused, since I believe this was fixed in [34]. But it was only fixed on the stable branch and subsequent releases -- maybe you're tracking trunk?

    (You're exactly right about loadTestsFromModule vs loadTestsFromPath, by the way -- the first loads doctests from python modules, the second from files that aren't python modules but that you've indicated via the --doctest-extension should be examined for doctests).

    I'm going to close the ticket as fixed, but please feel free to reopen if you are seeing this behavior in a release or in the stable branch.

    Wed Jun 7 13:17:42 2006: Modified by lbruno@republico.estv.ipv.pt

    • resolution cleared
    • status changed from closed to reopened

    In my first search, I didn't spot #55; sorry. [34] was applied to -stable but not to -trunk, as far as I can tell; And you're correct: I'm following -trunk.

    So, if you haven't applied it to -trunk because you're planning to rework this part, please re-close this ticket. If not, the patch in #55 is better because it has a unittest. Ignore mine.

    Thanks!

    Wed Jun 21 18:48:07 2006: Modified by jpellerin

    • milestone changed from 1.0 to 0.9
    • version changed from 0.9a1 to 0.9

    Note to self: hold this open until stable is merged into trunk

    Wed Jun 21 21:12:51 2006: Modified by jpellerin

    • resolution set to fixed
    • status changed from reopened to closed

    Stable has been merged to trunk as of [62]. Closing.