mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
Alo use load_tests() for adding tests.
This commit is contained in:
		
							parent
							
								
									5e2c32e08e
								
							
						
					
					
						commit
						a856364cc9
					
				
					 17 changed files with 117 additions and 183 deletions
				
			
		|  | @ -1,3 +1,7 @@ | |||
| import doctest | ||||
| import unittest | ||||
| 
 | ||||
| 
 | ||||
| doctests = """ | ||||
| ########### Tests mostly copied from test_listcomps.py ############ | ||||
| 
 | ||||
|  | @ -147,21 +151,10 @@ | |||
| 
 | ||||
| __test__ = {'doctests' : doctests} | ||||
| 
 | ||||
| def test_main(verbose=None): | ||||
|     import sys | ||||
|     from test import support | ||||
|     from test import test_setcomps | ||||
|     support.run_doctest(test_setcomps, verbose) | ||||
| def load_tests(loader, tests, pattern): | ||||
|     tests.addTest(doctest.DocTestSuite()) | ||||
|     return tests | ||||
| 
 | ||||
|     # verify reference counting | ||||
|     if verbose and hasattr(sys, "gettotalrefcount"): | ||||
|         import gc | ||||
|         counts = [None] * 5 | ||||
|         for i in range(len(counts)): | ||||
|             support.run_doctest(test_setcomps, verbose) | ||||
|             gc.collect() | ||||
|             counts[i] = sys.gettotalrefcount() | ||||
|         print(counts) | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     test_main(verbose=True) | ||||
|     unittest.main() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka