Change ValueError to io.UnsupportedOperation in capture.py. Resolves issue #2276
This commit is contained in:
		
							parent
							
								
									fa15ae7545
								
							
						
					
					
						commit
						dc6890709e
					
				|  | @ -13,6 +13,7 @@ import py | ||||||
| import pytest | import pytest | ||||||
| 
 | 
 | ||||||
| from py.io import TextIO | from py.io import TextIO | ||||||
|  | from io import UnsupportedOperation | ||||||
| unicode = py.builtin.text | unicode = py.builtin.text | ||||||
| 
 | 
 | ||||||
| patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'} | patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'} | ||||||
|  | @ -448,7 +449,7 @@ class DontReadFromInput: | ||||||
|     __iter__ = read |     __iter__ = read | ||||||
| 
 | 
 | ||||||
|     def fileno(self): |     def fileno(self): | ||||||
|         raise ValueError("redirected Stdin is pseudofile, has no fileno()") |         raise UnsupportedOperation("redirected Stdin is pseudofile, has no fileno()") | ||||||
| 
 | 
 | ||||||
|     def isatty(self): |     def isatty(self): | ||||||
|         return False |         return False | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ from __future__ import with_statement | ||||||
| import pickle | import pickle | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
|  | from io import UnsupportedOperation | ||||||
| 
 | 
 | ||||||
| import _pytest._code | import _pytest._code | ||||||
| import py | import py | ||||||
|  | @ -658,7 +659,7 @@ def test_dontreadfrominput(): | ||||||
|     pytest.raises(IOError, f.read) |     pytest.raises(IOError, f.read) | ||||||
|     pytest.raises(IOError, f.readlines) |     pytest.raises(IOError, f.readlines) | ||||||
|     pytest.raises(IOError, iter, f) |     pytest.raises(IOError, iter, f) | ||||||
|     pytest.raises(ValueError, f.fileno) |     pytest.raises(UnsupportedOperation, f.fileno) | ||||||
|     f.close()  # just for completeness |     f.close()  # just for completeness | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue