33 |
|
|
34 |
import unittest, os.path, fnmatch, string, imp |
import unittest, os.path, fnmatch, string, imp |
35 |
|
|
36 |
|
true = 1 |
37 |
|
false = 0 |
38 |
|
enableJNI = false |
39 |
|
|
40 |
def tests(files): |
def tests(files): |
41 |
""" |
""" |
42 |
Return a list of all *.test files in a given directory and its |
Return a list of all *.test files in a given directory and its |
75 |
tests = {} |
tests = {} |
76 |
exec compiledTestFile in globals(), tests |
exec compiledTestFile in globals(), tests |
77 |
|
|
78 |
|
try: |
79 |
|
if tests.keys().index('requiresJNI') >= 0: |
80 |
|
if enableJNI == false: |
81 |
|
print file + " skipped: JNI required." |
82 |
|
return |
83 |
|
except ValueError: |
84 |
|
pass |
85 |
|
|
86 |
testnames = [t for t in tests.keys() if t.startswith('test')] |
testnames = [t for t in tests.keys() if t.startswith('test')] |
87 |
|
|
88 |
code = '''class %s(unittest.TestCase): |
code = '''class %s(unittest.TestCase): |
130 |
omit -- files/subdirectories to avoid (defaults to empty list) |
omit -- files/subdirectories to avoid (defaults to empty list) |
131 |
""" |
""" |
132 |
return unittest.TestSuite([unittest.makeSuite(load(t)) |
return unittest.TestSuite([unittest.makeSuite(load(t)) |
133 |
for t in tests(files)]) |
for t in tests(files) if load(t)]) |
134 |
|
|
135 |
|
|
136 |
if __name__ == '__main__': |
if __name__ == '__main__': |
149 |
gzz.util.dbg.option(o,a) |
gzz.util.dbg.option(o,a) |
150 |
|
|
151 |
test = args |
test = args |
152 |
|
try: |
153 |
|
if test.index('jni') >=0: |
154 |
|
enableJNI = true |
155 |
|
test.remove('jni') |
156 |
|
except ValueError: |
157 |
|
pass |
158 |
unittest.TextTestRunner(verbosity=2).run(suite(test)) |
unittest.TextTestRunner(verbosity=2).run(suite(test)) |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|