Change ValueError to io.UnsupportedOperation in capture.py. Resolves issue #2276

This commit is contained in:
Xander Johnson 2017-03-14 12:45:56 -07:00 committed by Bruno Oliveira
parent fa15ae7545
commit dc6890709e
2 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import py
import pytest
from py.io import TextIO
from io import UnsupportedOperation
unicode = py.builtin.text
patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'}
@ -448,7 +449,7 @@ class DontReadFromInput:
__iter__ = read
def fileno(self):
raise ValueError("redirected Stdin is pseudofile, has no fileno()")
raise UnsupportedOperation("redirected Stdin is pseudofile, has no fileno()")
def isatty(self):
return False

View File

@ -4,6 +4,7 @@ from __future__ import with_statement
import pickle
import os
import sys
from io import UnsupportedOperation
import _pytest._code
import py
@ -658,7 +659,7 @@ def test_dontreadfrominput():
pytest.raises(IOError, f.read)
pytest.raises(IOError, f.readlines)
pytest.raises(IOError, iter, f)
pytest.raises(ValueError, f.fileno)
pytest.raises(UnsupportedOperation, f.fileno)
f.close() # just for completeness