nose-devs/nose — Issue #322: sys.stdout modification interferes with output collection
Author: jpellerin
Created: 2011-12-14 16:07:47+00:00
State: open

What steps will reproduce the problem?

------------------
# nose_test.py
import sys
import os
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

def test():
assert 1
--------------------------

$nosetests nose_test.py # throws error
$nosetests -s nose_test.py # runs fine

What is the expected output? What do you see instead?

expected: OK
instead:

nosetests
E
======================================================================
ERROR: Failure: AttributeError ('cStringIO.StringO' object has no attribute
'fileno')
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/nose-0.10.4-py2.4.egg/nose/loader.py",
line 363, in loadTestsFromName
module = self.importer.importFromPath(
File
"/usr/lib/python2.4/site-packages/nose-0.10.4-py2.4.egg/nose/importer.py",
line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File
"/usr/lib/python2.4/site-packages/nose-0.10.4-py2.4.egg/nose/importer.py",
line 84, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/nfs/data/home/gregg/local/src/gits/oui/trunk/nose_test.py", line
3, in ?
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
AttributeError: 'cStringIO.StringO' object has no attribute 'fileno'

----------------------------------------------------------------------

What version of the product are you using? On what operating system?

nosetests version 0.10.4
Linux FC5 on x64

Google Code Info:
Issue #: 243
Author: gregg.l...@gmail.com
Created On: 2009-03-06T18:48:04.000Z
Closed On: 2009-03-06T19:05:40.000Z