resolves issue 18 multiprocessing py.test co-existence

add fileno() method and test DontReadFromInput redirection some more

--HG--
branch : 1.0.x
This commit is contained in:
holger krekel 2009-06-24 16:35:01 +02:00
parent 74ba91dd50
commit 2b12f3f538
3 changed files with 15 additions and 2 deletions

View File

@ -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
=============================================

View File

@ -137,6 +137,8 @@ class DontReadFromInput:
readlines = read
__iter__ = read
def fileno(self):
raise ValueError("redirected Stdin is pseudofile, has no fileno()")
def isatty(self):
return False

View File

@ -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)