Statistics
| Branch: | Tag: | Revision:

root / test / __main__.py @ 902f1fb9

History | View | Annotate | Download (1.1 kB)

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

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

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

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

    
22
all_cases = [
23
    KKQuotaHolderAPITest,
24
    LimitsTest
25
]
26

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