Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7232091
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/xcap/test/test.py b/xcap/test/test.py
index 23dd027..41bb40f 100644
--- a/xcap/test/test.py
+++ b/xcap/test/test.py
@@ -1,62 +1,66 @@
#!/usr/bin/env python
import sys
import os
import traceback
from optparse import OptionParser
from common import *
class TestHarness(object):
"""A test harness for OpenXCAP."""
def __init__(self, tests, option_parser):
"""Constructor to populate the TestHarness instance.
tests should be a list of module names (strings).
"""
self.tests = tests
self.option_parser = option_parser
self.test_suites = []
self.import_errors = 0
for testmod in self.tests:
try:
+ self.import_errors += 1
m = __import__(testmod, globals(), locals())
suite = loadSuiteFromModule(m, option_parser)
suite.modname = testmod
self.test_suites.append(suite)
+ self.import_errors -= 1
+ except AssertionError, ex:
+ if str(ex)!='disabled':
+ traceback.print_exc()
except Exception:
traceback.print_exc()
- self.import_errors = 1
def run(self, options, args):
run_suite(TestSuite(self.test_suites), options, args)
if self.import_errors:
sys.exit('there were import errors!')
def all_tests():
my_dir = os.path.dirname(os.path.abspath(__file__))
lst = [x.strip('.py') for x in os.listdir(my_dir) if x.startswith('test_') and x.endswith('.py')]
return lst
def run():
read_xcapclient_cfg()
parser = OptionParser(conflict_handler='resolve')
parser.add_option('-d', '--debug', action='store_true', default=False)
parser.add_option("-l", "--list", action="store_true", help="Print list of all tests")
t = TestHarness(all_tests(), parser)
options, args = parser.parse_args()
if options.list:
for x in t.test_suites:
print x.modname
for i in x:
print ' - ', i
print
return
check_options(options)
t.run(options, args)
if __name__ == '__main__':
run()
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Dec 28, 9:29 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3454254
Default Alt Text
(2 KB)
Attached To
Mode
rOPENXCAP OpenXCAP
Attached
Detach File
Event Timeline
Log In to Comment