mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	expected failure should not trigger failfast behavior in unittest.
This commit is contained in:
		
							parent
							
								
									49899690a8
								
							
						
					
					
						commit
						0ce167277a
					
				
					 3 changed files with 1 additions and 8 deletions
				
			
		|  | @ -2113,12 +2113,6 @@ def testFailFast(self): | ||||||
|         result.addUnexpectedSuccess(None) |         result.addUnexpectedSuccess(None) | ||||||
|         self.assertTrue(result.shouldStop) |         self.assertTrue(result.shouldStop) | ||||||
| 
 | 
 | ||||||
|         result = unittest.TestResult() |  | ||||||
|         result._exc_info_to_string = lambda *_: '' |  | ||||||
|         result.failfast = True |  | ||||||
|         result.addExpectedFailure(None, None) |  | ||||||
|         self.assertTrue(result.shouldStop) |  | ||||||
| 
 |  | ||||||
|     def testFailFastSetByRunner(self): |     def testFailFastSetByRunner(self): | ||||||
|         runner = unittest.TextTestRunner(stream=StringIO(), failfast=True) |         runner = unittest.TextTestRunner(stream=StringIO(), failfast=True) | ||||||
|         def test(result): |         def test(result): | ||||||
|  |  | ||||||
|  | @ -178,7 +178,7 @@ def runTests(self): | ||||||
|                 testRunner = self.testRunner(verbosity=self.verbosity, |                 testRunner = self.testRunner(verbosity=self.verbosity, | ||||||
|                                              failfast=self.failfast) |                                              failfast=self.failfast) | ||||||
|             except TypeError: |             except TypeError: | ||||||
|                 # didn't accept the verbosity or failfast argument |                 # didn't accept the verbosity or failfast arguments | ||||||
|                 testRunner = self.testRunner() |                 testRunner = self.testRunner() | ||||||
|         else: |         else: | ||||||
|             # it is assumed to be a TestRunner instance |             # it is assumed to be a TestRunner instance | ||||||
|  |  | ||||||
|  | @ -81,7 +81,6 @@ def addSkip(self, test, reason): | ||||||
|         """Called when a test is skipped.""" |         """Called when a test is skipped.""" | ||||||
|         self.skipped.append((test, reason)) |         self.skipped.append((test, reason)) | ||||||
| 
 | 
 | ||||||
|     @failfast |  | ||||||
|     def addExpectedFailure(self, test, err): |     def addExpectedFailure(self, test, err): | ||||||
|         """Called when an expected failure/error occured.""" |         """Called when an expected failure/error occured.""" | ||||||
|         self.expectedFailures.append( |         self.expectedFailures.append( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Michael Foord
						Michael Foord