-
Notifications
You must be signed in to change notification settings - Fork 16
/
test.py
33 lines (28 loc) · 1.12 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env python
import unittest, logging, os, sys
from databasic.logic.test.wordhandlertest import *
from databasic.logic.test.filehandlertest import *
from databasic.logic.test.wtfcsvstattest import *
from databasic.logic.test.connectthedotstest import *
from databasic.logic.test.connectthedotsbigdatatest import *
from databasic.logic.test.dbtest import *
test_classes = [
WordHandlerTest,
FileHandlerTest,
MongoHandlerTest,
WTFCSVStatTest,
ConnectTheDotsTest,
# ConnectTheDotsBigDataTest
]
# set up all logging to DEBUG (cause we're running tests here!)
logging.basicConfig(level=logging.DEBUG)
log_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log_handler = logging.FileHandler(os.path.join('logs/','test.log'))
log_handler.setFormatter(log_formatter)
# now run all the tests
suites = [ unittest.TestLoader().loadTestsFromTestCase(test_class) for test_class in test_classes ]
if __name__ == "__main__":
suite = unittest.TestSuite(suites)
test_result = unittest.TextTestRunner(verbosity=2).run(suite)
if not test_result.wasSuccessful():
sys.exit(1)