fix issue555: just add "errors" attribute to internal Capture stream.
This commit is contained in:
		
							parent
							
								
									d16fdb378c
								
							
						
					
					
						commit
						1d7b574b31
					
				|  | @ -8,6 +8,9 @@ NEXT | |||
| - fix issue437 where assertion rewriting could cause pytest-xdist slaves | ||||
|   to collect different tests. Thanks Bruno Oliveira. | ||||
| 
 | ||||
| - fix issue555: add "errors" attribute to capture-streams to satisfy | ||||
|   some distutils and possibly other code accessing sys.stdout.errors. | ||||
| 
 | ||||
| - fix issue547 capsys/capfd also work when output capturing ("-s") is disabled. | ||||
| 
 | ||||
| - address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via | ||||
|  |  | |||
|  | @ -1,2 +1,2 @@ | |||
| # | ||||
| __version__ = '2.6.1.dev2' | ||||
| __version__ = '2.6.1.dev3' | ||||
|  |  | |||
|  | @ -223,6 +223,7 @@ def safe_text_dupfile(f, mode, default_encoding="UTF8"): | |||
| 
 | ||||
| 
 | ||||
| class EncodedFile(object): | ||||
|     errors = "strict"  # possibly needed by py3 code (issue555) | ||||
|     def __init__(self, buffer, encoding): | ||||
|         self.buffer = buffer | ||||
|         self.encoding = encoding | ||||
|  |  | |||
							
								
								
									
										2
									
								
								setup.py
								
								
								
								
							
							
						
						
									
										2
									
								
								setup.py
								
								
								
								
							|  | @ -27,7 +27,7 @@ def main(): | |||
|         name='pytest', | ||||
|         description='pytest: simple powerful testing with Python', | ||||
|         long_description=long_description, | ||||
|         version='2.6.1.dev2', | ||||
|         version='2.6.1.dev3', | ||||
|         url='http://pytest.org', | ||||
|         license='MIT license', | ||||
|         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], | ||||
|  |  | |||
|  | @ -1012,3 +1012,13 @@ def test_capturing_and_logging_fundamentals(testdir, method): | |||
|     """) | ||||
|     assert "atexit" not in result.stderr.str() | ||||
| 
 | ||||
| 
 | ||||
| def test_error_attribute_issue555(testdir): | ||||
|     testdir.makepyfile(""" | ||||
|         import sys | ||||
|         def test_capattr(): | ||||
|             assert sys.stdout.errors == "strict" | ||||
|             assert sys.stderr.errors == "strict" | ||||
|     """) | ||||
|     reprec = testdir.inline_run() | ||||
|     reprec.assertoutcome(passed=1) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue