diff --git a/AUTHORS b/AUTHORS index 04fa9bfad..ca41d0ac1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -131,5 +131,6 @@ Tom Viner Trevor Bekolay Tyler Goodlet Vasily Kuznetsov +Vlad Dragos Wouter van Ackooy Xuecong Liao diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 57cb3df44..29fba4ac0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,6 +24,8 @@ Changes * ``--pdbcls`` no longer implies ``--pdb``. This makes it possible to use ``addopts=--pdbcls=module.SomeClass`` on ``pytest.ini``. Thanks `@davidszotten`_ for the PR (`#1952`_). +* Change exception raised by ``capture.DontReadFromInput.fileno()`` from ``ValueError`` + to ``io.UnsupportedOperation``. Thanks `@vlad-dragos`_ for the PR. .. _@davidszotten: https://github.com/davidszotten @@ -92,6 +94,7 @@ Changes .. _@raquel-ucl: https://github.com/raquel-ucl .. _@axil: https://github.com/axil .. _@tgoodlet: https://github.com/tgoodlet +.. _@vlad-dragos: https://github.com/vlad-dragos .. _#1853: https://github.com/pytest-dev/pytest/issues/1853 .. _#1905: https://github.com/pytest-dev/pytest/issues/1905 diff --git a/_pytest/capture.py b/_pytest/capture.py index 9f60db6ac..b467dc17b 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -7,6 +7,7 @@ from __future__ import with_statement import contextlib import sys import os +from io import UnsupportedOperation from tempfile import TemporaryFile import py @@ -447,7 +448,8 @@ 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