[issue8048] doctest assumes sys.displayhook hasn't been touched

Noam Raphael report at bugs.python.org
Wed Mar 3 09:17:35 CET 2010


New submission from Noam Raphael <noamraph at gmail.com>:

Hello,

This bug is the cause of a bug reported about DreamPie: https://bugs.launchpad.net/bugs/530969

DreamPie (http://dreampie.sourceforge.net) changes sys.displayhook so that values will be sent to the parent process instead of being printed in stdout. This causes doctest to fail when run from DreamPie, because it implicitly assumes that sys.displayhook writes the values it gets to sys.stdout. This is why doctest replaces sys.stdout with its own file-like object, which is ready to receive the printed values.

The solution is simply to replace sys.displayhook with a function that will do the expected thing, just like sys.stdout is replaced. The patch I attach does exactly this.

Thanks,
Noam

----------
components: Library (Lib)
files: doctest.py.diff
keywords: patch
messages: 100334
nosy: noam
severity: normal
status: open
title: doctest assumes sys.displayhook hasn't been touched
type: behavior
Added file: http://bugs.python.org/file16421/doctest.py.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8048>
_______________________________________


More information about the Python-bugs-list mailing list