Open asmeurer opened 13 years ago
I believe this is the problem, and it leads to another annoying things not being included in the test report as well, such as warnings. For example, if you create a file called test.py
with the following:
import warnings
warnings.warn('test')
print 'print test'
raise RuntimeError
and run
$python test.py 2> test
Then print test
will be printed to the terminal, and the file test
will contain the output from standard error:
test.py:2: UserWarning: test
warnings.warn('test')
Traceback (most recent call last):
File "test.py", line 4, in <module>
raise RuntimeError
RuntimeError
I'm not sure how to fix this though. The basic way that the test report is written (in sympy-next) is
out = subprocess.Popen(command, stdout=subprocess.PIPE).stdout
report = []
def my_join(file):
while True:
char = file.read(1)
if not char:
break
log.write(char)
log.flush()
if verbose:
sys.stdout.write(char)
yield char
def my_split(iter):
buf = ''
for c in iter:
buf += c
splits = ['sympy/', 'doc/']
for s in splits:
if buf.endswith(s):
r = buf[:-len(s)]
buf = s
yield r
yield buf
for line in my_split(my_join(out)):
import re
good = None
if line.find('[OK]') != -1:
good = True
elif line.find('[FAIL]') != -1:
good = False
elif re.search(' \[\d*\]', line):
good = False
if good is None:
continue
report.append((line.split('[')[0].split()[0], good))
Note how we get the output of stdout from the command to write to the file (stderr is written the the console automatically). How do we also write the output of stderr in the order (or roughly the same order) that it was written to the console, so that we can see where the problems were?
At http://pastehtml.com/view/b91akw9zi.html, the test runner was killed. This was the output in my terminal:
You can see that the traceback was not included in the test report. My guess is that we need to pipe stderr to the report in addition to stdout, but I haven't checked.