Commits

Anonymous committed 3172fb9

fixed bug with -T, run test X times

Comments (0)

Files changed (3)

     meta['random_seed'] = seed
     print "\nRANDOM SEED USED: %s\n" % seed
     random.seed(seed)
-    
-    # if options.randomize or options.seed:
-    #     print "\nRANDOM SEED USED: %s\n" % meta_results['random_seed']
+    random.shuffle(test_modules)
         
 ################################################################################
 # Single process mode
 untrusty_total, combined = combine_results(results, t)
 total, fails = test_failures(results)
 
-if not options.subprocess: assert total == untrusty_total
+if not options.subprocess:
+    assert total == untrusty_total
 
-if not options.dump:# or (options.human and untrusty_total == total):
+if not options.dump:
     print combined
 else:
     results = options.all and results or fails
+    meta['total_tests'] = total
+    meta['combined'] = combined
     results.update(meta_results)
 
     print TEST_RESULTS_START
 
     return total, errors
 
-def combined_errs(results):
-    for result in results.values():
-        combined_errs = result['errors'] + result['failures']
-        for err in combined_errs:
-            yield err
+# def combined_errs(results):
+#     for result in results.values():
+#         combined_errs = result['errors'] + result['failures']
+#         for err in combined_errs:
+#             yield err
 
 ################################################################################
 # For complete failures (+ namespace saving)

unittest_patch.py

             
             tests["times"] += [time.time() -t]
             
-            if ok:
-                if i == 0:
-                    result.addSuccess(self)
-            else: break
-            
-            
-            
+            if not ok: break            
+        
+            # if ok:
+            #     if i == 0:
+            #         result.addSuccess(self)
+            # else: break
+    
+        if ok:
+            result.addSuccess(self)
     ########################################################################
     # Post run
 
             if testFnName not in testFnNames:  # handle overridden methods
                 testFnNames.append(testFnName)
 
-    if self.randomize_tests:
+    if self.randomize_tests: 
         random.shuffle(testFnNames)
     elif self.sortTestMethodsUsing:
         testFnNames.sort(self.sortTestMethodsUsing)
 ################################################################################
 
 def patch(options):
+    # Incomplete todo_xxx tests
     if options.incomplete:
         unittest.TestLoader.testMethodPrefix = (
             unittest.TestLoader.testMethodPrefix, 'todo_'
         )
     
+    # Randomizing    
     unittest.TestLoader.randomize_tests = options.randomize or options.seed
 
     unittest.TestLoader.getTestCaseNames = getTestCaseNames