Skip to content

Commit

Permalink
Change ValueError to io.UnsupportedOperation in capture.py. Resolves …
Browse files Browse the repository at this point in the history
  • Loading branch information
Xander Johnson committed Mar 14, 2017
1 parent 5e52a4d commit 96eedca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion _pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pytest

from py.io import TextIO
from io import UnsupportedOperation
unicode = py.builtin.text

patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'}
Expand Down Expand Up @@ -448,7 +449,7 @@ def read(self, *args):
__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
Expand Down
3 changes: 2 additions & 1 deletion testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pickle
import os
import sys
from io import UnsupportedOperation

import _pytest._code
import py
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 96eedca

Please sign in to comment.