[py-svn] commit/pytest: hpk42: finally fixing a bug that resulted in sometimes-failing duration tests (doh)

Bitbucket commits-noreply at bitbucket.org
Fri Nov 18 18:35:41 CET 2011


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/56fdd8bb08ca/
changeset:   56fdd8bb08ca
user:        hpk42
date:        2011-11-18 18:35:23
summary:     finally fixing a bug that resulted in sometimes-failing duration tests (doh)
affected #:  3 files

diff -r c7127c5e5ee38d8ecb7683f5b4dd5ff44c107154 -r 56fdd8bb08ca14b168993d44c7dfa5147f06dfff _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
 #
-__version__ = '2.2.0.dev10'
+__version__ = '2.2.0.dev11'


diff -r c7127c5e5ee38d8ecb7683f5b4dd5ff44c107154 -r 56fdd8bb08ca14b168993d44c7dfa5147f06dfff _pytest/runner.py
--- a/_pytest/runner.py
+++ b/_pytest/runner.py
@@ -25,23 +25,22 @@
     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))


diff -r c7127c5e5ee38d8ecb7683f5b4dd5ff44c107154 -r 56fdd8bb08ca14b168993d44c7dfa5147f06dfff setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@
         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'],

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list