run all test suites, if called as main
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								97da16f4bc
							
						
					
				
			
			
				commit
				
					
						6d7620582d
					
				
			
		
					 1 changed files with 7 additions and 10 deletions
				
			
		| 
						 | 
					@ -1,4 +1,3 @@
 | 
				
			||||||
#c1406:!/usr/bin/env python3
 | 
					 | 
				
			||||||
#!/usr/bin/env python3
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
# -*- coding: utf-8 -*-
 | 
					# -*- coding: utf-8 -*-
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -36,16 +35,14 @@ for possible_test in os.listdir(base_dir):
 | 
				
			||||||
    if os.path.isfile(mod_path):
 | 
					    if os.path.isfile(mod_path):
 | 
				
			||||||
        test_modules.append(possible_test)
 | 
					        test_modules.append(possible_test)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print(sys.path)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
suites = []
 | 
					suites = []
 | 
				
			||||||
 | 
					 | 
				
			||||||
for test_module in test_modules:
 | 
					for test_module in test_modules:
 | 
				
			||||||
    module = imp.find_module(test_module, [base_dir])
 | 
					    module_parameters = imp.find_module(test_module, [base_dir])
 | 
				
			||||||
    imp.load_module(test_module, *module)
 | 
					    module = imp.load_module("cdist.test." + test_module, *module_parameters)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print(module)
 | 
					    suite = unittest.defaultTestLoader.loadTestsFromModule(module)
 | 
				
			||||||
    # module_name = 
 | 
					    # print("Got suite: " + suite.__str__())
 | 
				
			||||||
 | 
					 | 
				
			||||||
    suite = unittest.defaultTestLoader.loadTestsFromModule("cdist.test." + test_module)
 | 
					 | 
				
			||||||
    suites.append(suite)
 | 
					    suites.append(suite)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					all_suites = unittest.TestSuite(suites)
 | 
				
			||||||
 | 
					unittest.TextTestRunner(verbosity=2).run(all_suites)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue