finally fixing a bug that resulted in sometimes-failing duration tests (doh)
This commit is contained in:
		
							parent
							
								
									a1d41c6811
								
							
						
					
					
						commit
						7bb7d1205c
					
				| 
						 | 
					@ -1,2 +1,2 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
__version__ = '2.2.0.dev10'
 | 
					__version__ = '2.2.0.dev11'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,23 +25,22 @@ def pytest_terminal_summary(terminalreporter):
 | 
				
			||||||
    if durations is None:
 | 
					    if durations is None:
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    tr = terminalreporter
 | 
					    tr = terminalreporter
 | 
				
			||||||
    duration2rep = {}
 | 
					    dlist = []
 | 
				
			||||||
    for key, replist in tr.stats.items():
 | 
					    for replist in tr.stats.values():
 | 
				
			||||||
        for rep in replist:
 | 
					        for rep in replist:
 | 
				
			||||||
            if hasattr(rep, 'duration'):
 | 
					            if hasattr(rep, 'duration'):
 | 
				
			||||||
                duration2rep[rep.duration] = rep
 | 
					                dlist.append((rep.duration, rep))
 | 
				
			||||||
    if not duration2rep:
 | 
					    if not dlist:
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    d2 = list(duration2rep.items())
 | 
					    dlist.sort()
 | 
				
			||||||
    d2.sort()
 | 
					    dlist.reverse()
 | 
				
			||||||
    d2.reverse()
 | 
					 | 
				
			||||||
    if not durations:
 | 
					    if not durations:
 | 
				
			||||||
        tr.write_sep("=", "slowest test durations")
 | 
					        tr.write_sep("=", "slowest test durations")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        tr.write_sep("=", "slowest %s test durations" % durations)
 | 
					        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("::()::", "::")
 | 
					        nodeid = rep.nodeid.replace("::()::", "::")
 | 
				
			||||||
        tr.write_line("%02.2fs %-8s %s" %
 | 
					        tr.write_line("%02.2fs %-8s %s" %
 | 
				
			||||||
            (duration, rep.when, nodeid))
 | 
					            (duration, rep.when, nodeid))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								setup.py
								
								
								
								
							
							
						
						
									
										2
									
								
								setup.py
								
								
								
								
							| 
						 | 
					@ -24,7 +24,7 @@ def main():
 | 
				
			||||||
        name='pytest',
 | 
					        name='pytest',
 | 
				
			||||||
        description='py.test: simple powerful testing with Python',
 | 
					        description='py.test: simple powerful testing with Python',
 | 
				
			||||||
        long_description = long_description,
 | 
					        long_description = long_description,
 | 
				
			||||||
        version='2.2.0.dev10',
 | 
					        version='2.2.0.dev11',
 | 
				
			||||||
        url='http://pytest.org',
 | 
					        url='http://pytest.org',
 | 
				
			||||||
        license='MIT license',
 | 
					        license='MIT license',
 | 
				
			||||||
        platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
 | 
					        platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue