Commits

holger krekel committed 56fdd8b

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

Comments (0)

Files changed (3)

_pytest/__init__.py

 #
-__version__ = '2.2.0.dev10'
+__version__ = '2.2.0.dev11'

_pytest/runner.py

     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))
         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'],