doctests behave differently inside dreampie
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DreamPie |
Triaged
|
Undecided
|
Unassigned |
Bug Description
Dreampie 1.0
Python sys.version_info: (2, 6, 2, 'final', 0)
Running the following code:
def demofunction(a, b):
'''Simple demonstration function
>>> demofunction(3, 4)
7
'''
return a+b
import doctest
doctest.testmod()
results in:
Dreampie:
>>> doctest.testmod()
*******
File "__main__", line 4, in __main_
Failed example:
demofunction(3, 4)
Expected:
7
Got nothing
*******
1 items had failures:
1 of 1 in __main_
***Test Failed*** 2 failures.
8: TestResults(
Python shell:
>>> doctest.testmod()
TestResults(
Changed in dreampie: | |
status: | New → Triaged |
Thanks for the report!
It turns out that the problem is that doctest assumes that sys.displayhook just prints the value it gets into stdout, while DreamPie installs a different displayhook.
I filed a bug at http:// bugs.python. org/issue8048 . In the meanwhile, you can replace your doctest.py file with the attached file, which fixes this bug.