Coverage for gpkit/tests/run_tests.py: 100%

31 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 16:49 -0500

1"""Script for running all gpkit unit tests""" 

2from gpkit.tests.helpers import run_tests 

3 

4 

5def import_tests(): 

6 """Get a list of all GPkit unit test TestCases""" 

7 tests = [] 

8 

9 from gpkit.tests import t_tools 

10 tests += t_tools.TESTS 

11 

12 from gpkit.tests import t_sub 

13 tests += t_sub.TESTS 

14 

15 from gpkit.tests import t_vars 

16 tests += t_vars.TESTS 

17 

18 from gpkit.tests import t_nomials 

19 tests += t_nomials.TESTS 

20 

21 from gpkit.tests import t_constraints 

22 tests += t_constraints.TESTS 

23 

24 from gpkit.tests import t_nomial_array 

25 tests += t_nomial_array.TESTS 

26 

27 from gpkit.tests import t_model 

28 tests += t_model.TESTS 

29 

30 from gpkit.tests import t_solution_array 

31 tests += t_solution_array.TESTS 

32 

33 from gpkit.tests import t_small 

34 tests += t_small.TESTS 

35 

36 from gpkit.tests import t_examples 

37 tests += t_examples.TESTS 

38 

39 from gpkit.tests import t_keydict 

40 tests += t_keydict.TESTS 

41 

42 return tests 

43 

44 

45def run(xmloutput=False, tests=None, verbosity=1): 

46 """Run all gpkit unit tests. 

47 

48 Arguments 

49 --------- 

50 xmloutput: bool 

51 If true, generate xml output files for continuous integration 

52 """ 

53 if tests is None: 

54 tests = import_tests() 

55 if xmloutput: 

56 run_tests(tests, xmloutput='test_reports') 

57 else: # pragma: no cover 

58 run_tests(tests, verbosity=verbosity) 

59 

60if __name__ == "__main__": # pragma: no cover 

61 run()