Issue8048
Created on 2010-03-03 08:17 by noam, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| doctest.py.diff | noam, 2010-03-03 08:17 | Diff for doctest.py (from python 2.6) | ||
| diff | noam, 2010-03-04 22:00 | Patch against Python 2, includes a test. | ||
| better.patch | noam, 2010-03-19 09:09 | Better patch | ||
| Messages (4) | |||
|---|---|---|---|
| msg100334 - (view) | Author: Noam Yorav-Raphael (noam) | Date: 2010-03-03 08:17 | |
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 |
|||
| msg100423 - (view) | Author: Noam Yorav-Raphael (noam) | Date: 2010-03-04 22:00 | |
Ok, here's a patch (against current svn of Python 2) with a test case. I had to fix three tests which combined pdb and doctest, since now, when run under doctest, pdb steps into the displayhook because it's a Python function and not a built-in function. The fix is just to return from the displayhook. If you wish, I can prepare a patch for Python 3. |
|||
| msg101312 - (view) | Author: Noam Yorav-Raphael (noam) | Date: 2010-03-19 09:09 | |
Here is a better and much shorter patch: I use sys.__displayhook__ instead of implementing it in Python, which has the nice side effect of not changing pdb behaviour. |
|||
| msg112054 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2010-07-30 09:23 | |
Thanks, applied to 3k in r83268. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:58 | admin | set | github: 52296 |
| 2010-07-30 09:23:29 | georg.brandl | set | status: open -> closed nosy:
+ georg.brandl resolution: fixed |
| 2010-03-19 09:09:25 | noam | set | files:
+ better.patch messages: + msg101312 |
| 2010-03-04 22:00:44 | noam | set | files:
+ diff messages: + msg100423 |
| 2010-03-03 12:08:35 | flox | set | priority: normal nosy: + flox stage: test needed versions: + Python 2.7, Python 3.2 |
| 2010-03-03 08:17:34 | noam | create | |
