There are a few questions you should know. Perhaps I repeat @arbunet's answer, but a little with me. Therefore, if you wait for the process to complete and redirect the "stdout" process to the test stdout, everything will be written correctly with the nose:
import subprocess import sys def test_popen(): p = subprocess.Popen(['python', 'example.py'], stdout=subprocess.PIPE) out, err = p.communicate() print out assert False
Here PIPE is created and redirected to stdout using a print statement. Alternatively, you can pass sys.__stdout__ (the unmolested stdout of the test) or another file descriptor to the Popen call, and then clear it in sys.stdout (the StringIO.StringIO instance created by the nose), but it looks less clean (compared to a simple print operator).
Oleksiy
source share