Commit a9c89a0b authored by Chris Withers's avatar Chris Withers

Collector #1445: Fixed bad interaction between -p and -v(v) options to test.py...

Collector #1445: Fixed bad interaction between -p and -v(v) options to test.py that resulted in exceptions being printed when they shouldn't have been.
parent 3874d21b
...@@ -139,6 +139,10 @@ Zope Changes ...@@ -139,6 +139,10 @@ Zope Changes
Bugs fixed Bugs fixed
- Collector #1445: Fixed bad interaction between -p and -v(v)
options to test.py that resulted in exceptions being printed
when they shouldn't have been.
- Collector #729: manage_main doesn't display the correct page title - Collector #729: manage_main doesn't display the correct page title
most of the time. It is not completely fixed but using title_or_id most of the time. It is not completely fixed but using title_or_id
makes folders display the correct id as a fallback. makes folders display the correct id as a fallback.
......
...@@ -254,15 +254,31 @@ class ImmediateTestResult(unittest._TextTestResult): ...@@ -254,15 +254,31 @@ class ImmediateTestResult(unittest._TextTestResult):
for i in range(n): for i in range(n):
print >>stream, "%6dms" % int(results[i][1] * 1000), results[i][0] print >>stream, "%6dms" % int(results[i][1] * 1000), results[i][0]
def _print_traceback(self, msg, err, test, errlist): def _handle_problem(self, err, test, errlist):
if self.showAll or self.dots or self._progress:
self.stream.writeln("\n") if self._debug:
self._lastWidth = 0 raise err[0], err[1], err[2]
if errlist is self.errors:
prefix = 'Error'
else:
prefix = 'Failure'
tb = "".join(traceback.format_exception(*err)) tb = "".join(traceback.format_exception(*err))
self.stream.writeln(msg)
self.stream.writeln(tb) if self._progress:
errlist.append((test, tb)) self.stream.writeln("\r")
self.stream.writeln("%s in test %s" % (prefix,test))
self.stream.writeln(tb)
self._lastWidth = 0
elif self.showAll:
self._lastWidth = 0
self.stream.writeln(prefix.upper())
elif self.dots:
self.stream.write(prefix[0])
if not self._progress:
errlist.append((test, tb))
def startTest(self, test): def startTest(self, test):
if self._progress: if self._progress:
...@@ -300,20 +316,10 @@ class ImmediateTestResult(unittest._TextTestResult): ...@@ -300,20 +316,10 @@ class ImmediateTestResult(unittest._TextTestResult):
return s[:self._maxWidth] return s[:self._maxWidth]
def addError(self, test, err): def addError(self, test, err):
if self._progress: self._handle_problem(err, test, self.errors)
self.stream.write("\r")
if self._debug:
raise err[0], err[1], err[2]
self._print_traceback("Error in test %s" % test, err,
test, self.errors)
def addFailure(self, test, err): def addFailure(self, test, err):
if self._progress: self._handle_problem(err, test, self.failures)
self.stream.write("\r")
if self._debug:
raise err[0], err[1], err[2]
self._print_traceback("Failure in test %s" % test, err,
test, self.failures)
def printErrors(self): def printErrors(self):
if self._progress and not (self.dots or self.showAll): if self._progress and not (self.dots or self.showAll):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment