finally fixing a bug that resulted in sometimes-failing duration tests (doh)

This commit is contained in:
holger krekel 2011-11-18 17:35:23 +00:00
parent a1d41c6811
commit 7bb7d1205c
3 changed files with 10 additions and 11 deletions

View File

@ -1,2 +1,2 @@
#
__version__ = '2.2.0.dev10'
__version__ = '2.2.0.dev11'

View File

@ -25,23 +25,22 @@ def pytest_terminal_summary(terminalreporter):
if durations is None:
return
tr = terminalreporter
duration2rep = {}
for key, replist in tr.stats.items():
dlist = []
for replist in tr.stats.values():
for rep in replist:
if hasattr(rep, 'duration'):
duration2rep[rep.duration] = rep
if not duration2rep:
dlist.append((rep.duration, rep))
if not dlist:
return
d2 = list(duration2rep.items())
d2.sort()
d2.reverse()
dlist.sort()
dlist.reverse()
if not durations:
tr.write_sep("=", "slowest test durations")
else:
tr.write_sep("=", "slowest %s test durations" % durations)
d2 = d2[:durations]
dlist = dlist[:durations]
for duration, rep in d2:
for duration, rep in dlist:
nodeid = rep.nodeid.replace("::()::", "::")
tr.write_line("%02.2fs %-8s %s" %
(duration, rep.when, nodeid))

View File

@ -24,7 +24,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.2.0.dev10',
version='2.2.0.dev11',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],