Statistics
| Branch: | Tag: | Revision:

root / test / __main__.py @ f611ef3d

History | View | Annotate | Download (1.2 kB)

1
import os
2
import sys
3
from kkquotaholderapi import KKQuotaHolderAPITest
4
from limits import LimitsTest
5
from createrelease import CreateReleaseListAPITest 
6

    
7
# The following trick is from from snf-tools/synnefo_tools/burnin.py:
8
# Use backported unittest functionality if Python < 2.7
9
try:
10
    import unittest2 as unittest
11
except ImportError:
12
    if sys.version_info < (2, 7):
13
        raise Exception("The unittest2 package is required for Python < 2.7")
14
    import unittest
15

    
16
HERE = os.path.dirname(__file__)
17

    
18
# Enumerate all test cases to run.
19
# In the command line use
20
#   $ python test
21
# to run them all
22

    
23
all_cases = [
24
    CreateReleaseListAPITest,
25
    KKQuotaHolderAPITest,
26
    LimitsTest
27
]
28

    
29
if __name__ == "__main__":
30
    print("Running tests from {0}".format(HERE))
31
    print("All tests are: {0}".format(all_cases))
32
    for test_case in all_cases:
33
        print("Executing {0}".format(test_case))
34
        # Again from snf-tools/synnefo_tools/burnin.py
35
        # Thank you John Giannelos <johngian@grnet.gr>
36
        suite = unittest.TestLoader().loadTestsFromTestCase(test_case)
37
        runner = unittest.TextTestRunner(stream = sys.stderr, verbosity = 2, failfast = True, buffer = False)
38
        result = runner.run(suite)