From 8985c0be3ec5294deb173d4161e2125adab18f37 Mon Sep 17 00:00:00 2001 From: Vlad Dragos Date: Mon, 26 Sep 2016 13:15:35 +0300 Subject: [PATCH 1/4] Change exception raised by DontReadFromInput.fileno() from ValueError to io.UnsupportedOperation --- _pytest/capture.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 9f60db6ac..f4b6e64c3 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,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 From ff492ca73fc038fcbe7f233594a9a19e4dbbe988 Mon Sep 17 00:00:00 2001 From: Vlad Dragos Date: Mon, 26 Sep 2016 13:27:41 +0300 Subject: [PATCH 2/4] Thanked my self in the change log :) --- AUTHORS | 1 + CHANGELOG.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index d8c431dc0..3d8dac890 100644 --- a/AUTHORS +++ b/AUTHORS @@ -129,5 +129,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 a67ec4eee..b3ecf9a3e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,8 @@ * Explain a bad scope value passed to ``@fixture`` declarations or a ``MetaFunc.parametrize()`` call. Thanks `@tgoodlet`_ for the PR. +* Change exception raised by ``capture.DontReadFromInput.fileno()`` from ``ValueError`` + to ``io.UnsupportedOperation``. Thanks `@vlad-dragos`_ for the PR. .. _@philpep: https://github.com/philpep .. _@raquel-ucl: https://github.com/raquel-ucl From 3444796f3e4ba147ccef4df735a8a09ea62b9e48 Mon Sep 17 00:00:00 2001 From: Vlad Dragos Date: Mon, 26 Sep 2016 13:59:28 +0300 Subject: [PATCH 3/4] Fix formating error. --- _pytest/capture.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index f4b6e64c3..b467dc17b 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -448,7 +448,8 @@ class DontReadFromInput: __iter__ = read def fileno(self): - raise UnsupportedOperation("redirected Stdin is pseudofile, has no fileno()") + raise UnsupportedOperation("redirected stdin is pseudofile, " + "has no fileno()") def isatty(self): return False From acac78adc0a5145e2b89c8db74ac8c8b0bc0c136 Mon Sep 17 00:00:00 2001 From: Vlad Dragos Date: Mon, 26 Sep 2016 16:09:25 +0300 Subject: [PATCH 4/4] Add link to profile. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b3ecf9a3e..0cfe42c79 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -26,6 +26,7 @@ .. _@raquel-ucl: https://github.com/raquel-ucl .. _@axil: https://github.com/axil .. _@tgoodlet: https://github.com/tgoodlet +.. _@vlad-dragos: https://github.com/vlad-dragos .. _#1905: https://github.com/pytest-dev/pytest/issues/1905 .. _#1934: https://github.com/pytest-dev/pytest/issues/1934