forked from benedictpaten/sonLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallTests.py
57 lines (48 loc) · 1.75 KB
/
allTests.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
#Copyright (C) 2006-2012 by Benedict Paten ([email protected])
#
#Released under the MIT license, see LICENSE.txt
import unittest
import bioioTest
import cigarsTest
import treeTest
import kvdbTest
import socket
try:
import networkx as NX
networkx_installed = True
import nxtreeTest
import nxnewickTest
except ImportError:
networkx_installed = False
from sonLib.bioio import system
from sonLib.bioio import parseSuiteTestOptions
from sonLib.bioio import getLogLevelString
class TestCase(unittest.TestCase):
def testSonLibCTests(self):
"""Run m,ost the sonLib CuTests, fail if any of them fail.
"""
system("sonLibTests %s" % getLogLevelString())
def allSuites():
bioioSuite = unittest.makeSuite(bioioTest.TestCase, 'test')
cigarsSuite = unittest.makeSuite(cigarsTest.TestCase, 'test')
treeSuite = unittest.makeSuite(treeTest.TestCase, 'test')
kvdbSuite = unittest.makeSuite(kvdbTest.TestCase, 'test')
cuTestsSuite = unittest.makeSuite(TestCase, 'test')
if not networkx_installed:
allTests = unittest.TestSuite((bioioSuite, cigarsSuite, treeSuite, kvdbSuite, cuTestsSuite))
else:
nxtreeSuite = unittest.makeSuite(nxtreeTest.TestCase, 'test')
nxnewickSuite = unittest.makeSuite(nxnewickTest.TestCase, 'test')
allTests = unittest.TestSuite((bioioSuite, cigarsSuite, treeSuite, kvdbSuite, cuTestsSuite,
nxtreeSuite, nxnewickSuite))
return allTests
def main():
parseSuiteTestOptions()
suite = allSuites()
runner = unittest.TextTestRunner()
i = runner.run(suite)
return len(i.failures) + len(i.errors)
if __name__ == '__main__':
import sys
sys.exit(main())