Merge pull request #2313 from nicoddemus/DontReadFromInput-exceptions
Dont read from input exceptions
This commit is contained in:
commit
76df77418d
1
AUTHORS
1
AUTHORS
|
@ -6,6 +6,7 @@ Contributors include::
|
|||
Abdeali JK
|
||||
Abhijeet Kasurde
|
||||
Ahn Ki-Wook
|
||||
Alexander Johnson
|
||||
Alexei Kozlenok
|
||||
Anatoly Bubenkoff
|
||||
Andreas Zeidler
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
3.0.8 (unreleased)
|
||||
==================
|
||||
|
||||
*
|
||||
* Change capture.py's ``DontReadFromInput`` class to throw ``io.UnsupportedOperation`` errors rather
|
||||
than ValueErrors in the ``fileno`` method (`#2276`_).
|
||||
Thanks `@metasyn`_ for the PR.
|
||||
|
||||
*
|
||||
|
||||
|
@ -12,13 +14,19 @@
|
|||
*
|
||||
|
||||
|
||||
.. _@metasyn: https://github.com/metasyn
|
||||
|
||||
|
||||
.. _#2276: https://github.com/pytest-dev/pytest/issues/2276
|
||||
|
||||
|
||||
3.0.7 (2017-03-14)
|
||||
==================
|
||||
|
||||
|
||||
* Fix issue in assertion rewriting breaking due to modules silently discarding
|
||||
other modules when importing fails
|
||||
Notably, importing the `anydbm` module is fixed. (`#2248`_).
|
||||
Notably, importing the ``anydbm`` module is fixed. (`#2248`_).
|
||||
Thanks `@pfhayes`_ for the PR.
|
||||
|
||||
* junitxml: Fix problematic case where system-out tag occured twice per testcase
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue