From 2b12f3f538d8895a3bf168618241ce241e076c6c Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 24 Jun 2009 16:35:01 +0200 Subject: [PATCH] resolves issue 18 multiprocessing py.test co-existence add fileno() method and test DontReadFromInput redirection some more --HG-- branch : 1.0.x --- CHANGELOG | 2 ++ py/io/stdcapture.py | 6 ++++-- py/io/testing/test_stdcapture.py | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4bdf9dab1..f0a0e9e91 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,8 @@ Changes between 1.0.0b3 and 1.0.0 * apply patch from Daniel Peolzleithner (issue #23) +* resolve issue #18, multiprocessing.Manager() and + redirection clash Changes between 1.0.0b1 and 1.0.0b3 ============================================= diff --git a/py/io/stdcapture.py b/py/io/stdcapture.py index eed9fb029..a43d4bf0e 100644 --- a/py/io/stdcapture.py +++ b/py/io/stdcapture.py @@ -136,9 +136,11 @@ class DontReadFromInput: readline = read readlines = read __iter__ = read - + + def fileno(self): + raise ValueError("redirected Stdin is pseudofile, has no fileno()") def isatty(self): - return False + return False try: devnullpath = os.devnull diff --git a/py/io/testing/test_stdcapture.py b/py/io/testing/test_stdcapture.py index e6cb8ea1f..5e857c5b2 100644 --- a/py/io/testing/test_stdcapture.py +++ b/py/io/testing/test_stdcapture.py @@ -1,6 +1,15 @@ import os, sys import py +def test_dontreadfrominput(): + from py.__.io.stdcapture import DontReadFromInput + f = DontReadFromInput() + assert not f.isatty() + py.test.raises(IOError, f.read) + py.test.raises(IOError, f.readlines) + py.test.raises(IOError, iter, f) + py.test.raises(ValueError, f.fileno) + class TestStdCapture: def getcapture(self, **kw): return py.io.StdCapture(**kw)