nose-devs/nose — Issue #264: Surprising doctest behaviour
Author: jpellerin
Created: 2011-12-14 16:05:53+00:00
State: open

What steps will reproduce the problem?

$ mkdir bug
$ cd bug
$ cat > test.py <<"EOF"
"""
It's a surprise this is not executed even with --doctest-tests.

Module docstring doctests are never executed, regardless of presence or
absence of --doctest-tests

>>> True
False
"""

def test():
"""
It's a surprise this is executed even without --doctest-tests, because
this is a test module. The --doctest-test docs say that test modules
aren't searched for doctests unless that option is used. They also say a
function shouldn't be both a test and a doctest, but that doesn't really
excuse the odd behaviour, and the contradiction with part of the
--doctest-test docs.

>>> True
True
"""
EOF
$ nosetests -v --with-doctest
Doctest: test ... ok

----------------------------------------------------------------------
Ran 1 test in 0.028s

OK

What is the expected output? What do you see instead?

Expect to see the module docstring doctest run, but not the function
docstring doctest. Got the reverse.

Please use labels and text to provide additional information.

see above

I previously raised one of these issues in issue 87, which was closed as
invalid, but coming back to this, I still think that the behaviour and docs
(and the implementation!) are at minimum highly confusing.

Google Code Info:
Issue #: 180
Author: j...@pobox.com
Created On: 2008-04-06T00:08:46.000Z
Closed On: