本文整理汇总了Python中unittest.TestSuite.addTest方法的典型用法代码示例。如果您正苦于以下问题:Python TestSuite.addTest方法的具体用法?Python TestSuite.addTest怎么用?Python TestSuite.addTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestSuite
的用法示例。
在下文中一共展示了TestSuite.addTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestValidity))
return suite
示例2: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestTutorialPageComments))
if MockMailHost:
suite.addTest(makeSuite(MockMailHostTests))
return suite
示例3: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestSSOLogin))
suite.addTest(makeSuite(TestSSOLoginIframe))
return suite
示例4: loadTestsFromModules
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def loadTestsFromModules(self, testCaseModules):
suite = TestSuite()
for testCaseModule in testCaseModules:
subSuite = self.loader.loadTestsFromModule(testCaseModule)
suite.addTest(subSuite)
return suite
示例5: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestPortlet))
suite.addTest(makeSuite(TestRenderer))
return suite
示例6: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestRuleManagementViews))
suite.addTest(makeSuite(TestRuleElementManagementViews))
return suite
示例7: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestInstallation))
suite.addTest(makeSuite(TestUwoshgrantsProposal))
return suite
示例8: MobileDetectionFactory
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def MobileDetectionFactory(uas, expected):
class MobileDetection(TestCase):
def testUA(self, ua):
app = DummyWSGI(ua)
request = app.request
mobiledetector.Middleware(app)
if self.expected:
self.assert_(request.mobile,
"Mobile Not Detected: %s" % ua)
else:
self.assert_(not request.mobile,
"Mobile Falsely Detected: %s" % ua)
def testnum(num):
def test(self):
return self.testUA(self.uas[num])
return test
MobileDetection.uas = uas
MobileDetection.expected = expected
suite = TestSuite()
for x in range(len(uas)):
if not uas[x].startswith('#'):
setattr(MobileDetection, 'test%s'%x, testnum(x))
suite.addTest(MobileDetection('test%s' % x))
return suite
示例9: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestHTTPHeaders))
return suite
示例10: build_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def build_suite(self, test_labels, extra_tests=None, **kwargs):
'''
Override the base class method to return a suite consisting of all
TestCase subclasses throughought the whole project.
'''
if test_labels:
suite = TestSuite()
else:
suite = DjangoTestSuiteRunner.build_suite(
self, test_labels, extra_tests, **kwargs
)
added_test_classes = set(t.__class__ for t in suite)
loader = TestLoader()
for fname in _get_module_names(os.getcwd()):
module = _import(_to_importable_name(fname))
for test_class in _get_testcases(module):
if test_class in added_test_classes:
continue
for method_name in loader.getTestCaseNames(test_class):
testname = '.'.join([
module.__name__, test_class.__name__, method_name
])
if self._test_matches(testname, test_labels):
suite.addTest(loader.loadTestsFromName(testname))
added_test_classes.add(test_class)
return reorder_suite(suite, (TestCase,))
示例11: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
from Products.PloneTestCase.layer import ZCMLLayer
suite = TestSuite()
suite.layer = ZCMLLayer
suite.addTest(makeSuite(TestCustomScript))
return suite
示例12: suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def suite():
"Builds a test suite for the GIS package."
s = TestSuite()
for test_suite in test_suite_names:
tsuite = getattr(__import__('django.contrib.gis.tests', globals(), locals(), [test_suite]),test_suite)
s.addTest(tsuite.suite())
return s
示例13: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
if have_photo:
suite.addTest(makeSuite(TestPhoto))
suite.addTest(makeSuite(TestPUTPhoto))
return suite
示例14: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
""" Test Suite
"""
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestHistory))
return suite
示例15: test_suite
# 需要导入模块: from unittest import TestSuite [as 别名]
# 或者: from unittest.TestSuite import addTest [as 别名]
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(MarscatsSettingsStorageXMLAdapterTests))
suite.addTest(makeSuite(exportMarscatsSettingsStorageTests))
suite.addTest(makeSuite(importMarscatsSettingsStorageTests))
return suite