本文整理汇总了Python中unittest.defaultTestLoader.loadTestsFromTestCase函数的典型用法代码示例。如果您正苦于以下问题:Python loadTestsFromTestCase函数的具体用法?Python loadTestsFromTestCase怎么用?Python loadTestsFromTestCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadTestsFromTestCase函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: suite
def suite():
suite = TestSuite()
suite.addTests(
defaultTestLoader.loadTestsFromTestCase(TestSubmissionModule))
suite.addTests(
defaultTestLoader.loadTestsFromTestCase(TestSubmission))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:7,代码来源:test_submission.py
示例2: tests
def tests(self):
from unittest import defaultTestLoader
yield defaultTestLoader.loadTestsFromTestCase(DetectorTest)
yield defaultTestLoader.loadTestsFromTestCase(ImporterTest)
from hwp5_uno.tests import test_hwp5_uno
yield defaultTestLoader.loadTestsFromModule(test_hwp5_uno)
from hwp5.tests import test_suite
yield test_suite()
开发者ID:hanul93,项目名称:pyhwp,代码行数:8,代码来源:components.py
示例3: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(LibraryAccessionTestCase))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(LibraryTestCase))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(SampleWebTestCase))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestRDFaLibrary))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:8,代码来源:test_samples.py
示例4: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(MatchCodeTests))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestMappedReads))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(ElandTests))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestElandMatches))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:8,代码来源:test_eland.py
示例5: _execute_test
def _execute_test(cls, test: FirmwareTestClass, router: Router, routers: List[Router]) -> TestResult:
if not isinstance(router, Router):
raise ValueError("Chosen Router is not a real Router...")
# proofed: this method runs in other process as the server
setproctitle(str(router.id) + " - " + str(test))
logging.debug("%sExecute test " + str(test) + " on Router(" + str(router.id) + ")", LoggerSetup.get_log_deep(2))
test_suite = defaultTestLoader.loadTestsFromTestCase(test)
# prepare all test cases
for test_case in test_suite:
logging.debug("%sTestCase " + str(test_case), LoggerSetup.get_log_deep(4))
test_case.prepare(router, routers)
result = TestResult()
cls.__setns(router)
try:
result = test_suite.run(result)
except Exception as e:
logging.error("%sTestCase execution raised an exception", LoggerSetup.get_log_deep(3))
logging.error("%s" + str(e), LoggerSetup.get_log_deep(3))
test_obj = test()
result.addError(test_obj, sys.exc_info()) # add the reason of the exception
finally:
# I'm sry for this dirty hack, but if you don't do this you get an
# "TypeError: cannot serialize '_io.TextIOWrapper' object" because sys.stdout is not serializeable...
result._original_stdout = None
result._original_stderr = None
logging.debug("%sResult from test " + str(result), LoggerSetup.get_log_deep(3))
return result
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:35,代码来源:server.py
示例6: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
for testcase in [ExerimentsTestCases,
TestEmailNotify,
TestSequencer]:
suite.addTests(defaultTestLoader.loadTestsFromTestCase(testcase))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:8,代码来源:test_experiments.py
示例7: test_with_stdout
def test_with_stdout(self):
class LoudTestCase(TestCase):
def test(self):
print('True is true, who knew!')
self.assertTrue(True)
loud_suite = TestSuite(
tests=defaultTestLoader.loadTestsFromTestCase(LoudTestCase)
)
with self.assertRaises(RuntimeError):
self._run_suite(loud_suite)
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:12,代码来源:test_test.py
示例8: test_with_no_stdout
def test_with_no_stdout(self):
class QuietTestCase(TestCase):
def test(self):
self.assertTrue(True)
quiet_suite = TestSuite(
tests=defaultTestLoader.loadTestsFromTestCase(QuietTestCase)
)
result = self._run_suite(quiet_suite)
# No errors should be raised and the suite should have passed
self.assertEqual(result.errors, [])
self.assertEqual(result.failures, [])
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:13,代码来源:test_test.py
示例9: main
def main(path="."):
wasSuccessful = True
suites = TestSuite()
#path = os.path.abspath(path)
print "path='%s'" % path
if type(path) is type([]):
paths = [os.path.abspath(p) for p in path]
[sys.path.append(p) for p in paths]
else:
if os.path.split(path)[1]=="apps":
paths = []
sys.path.append(path)
for file in os.listdir(path):
p = os.path.join(path, file)
if os.path.isdir(p) and not file.startswith("."):
paths.append(p)
sys.path.append(p)
print
print "**********************"
print "%s" % paths
print "**********************"
print
else:
sys.path.append(path)
paths = [path]
for path in paths:
os.chdir(path)
print
print "**********************"
print "Processing '%s'" % path
print "**********************"
print
testClasses = getAllTestClasses(path=path)
for filename, testClassName, testClass in testClasses:
suite = defaultTestLoader.loadTestsFromTestCase(testClass)
print "file='%s', class='%s', test=%s" % (filename, testClassName, suite.countTestCases())
#result = TextTestRunner(verbosity=1).run(suite)
#if not result.wasSuccessful:
# wasSuccessful = False
suites.addTest(suite)
result = TextTestRunner(verbosity=1).run(suites)
if result.wasSuccessful==False:
wasSuccessful = False
if wasSuccessful:
print "Completed all tests OK."
return True
else:
print "*** One or more tests Failed! ***"
return result
开发者ID:ptsefton,项目名称:integrated-content-environment,代码行数:50,代码来源:pyunit.py
示例10: test_with_stdout
def test_with_stdout(self):
class LoudTestCase(TestCase):
def test(self):
print('True is true, who knew!')
self.assertTrue(True)
loud_suite = TestSuite(
tests=defaultTestLoader.loadTestsFromTestCase(LoudTestCase)
)
with self.assertRaises(AssertionError):
StdoutCapturingTestRunner(verbosity=0).run_suite(
loud_suite,
stream=StringIO()
)
开发者ID:contolini,项目名称:cfgov-refresh,代码行数:15,代码来源:test_test.py
示例11: test_with_no_stdout
def test_with_no_stdout(self):
class QuietTestCase(TestCase):
def test(self):
self.assertTrue(True)
quiet_suite = TestSuite(
tests=defaultTestLoader.loadTestsFromTestCase(QuietTestCase)
)
# Supress test case output while this runs so we don't get weird
# test-case-in-our-test-case messaging
result = StdoutCapturingTestRunner().run_suite(
quiet_suite,
stream=StringIO()
)
# No errors should be raised and the suite should have passed
self.assertEqual(result.errors, [])
self.assertEqual(result.failures, [])
开发者ID:contolini,项目名称:cfgov-refresh,代码行数:19,代码来源:test_test.py
示例12: RunTests
def RunTests():
global TestLoader, TextTestRunner, MemoryCtx
tests = [
TestScAddr,
TestScType,
TestScMemoryContext,
TestScSet,
TestEvents,
TestScHelper,
]
for testItem in tests:
testItem.MemoryCtx = MemoryCtx
testItem.module = module
suite = defaultTestLoader.loadTestsFromTestCase(testItem)
res = TextTestRunner(verbosity=2).run(suite)
if not res.wasSuccessful():
raise Exception("Unit test failed")
开发者ID:ShunkevichDV,项目名称:sc-machine,代码行数:19,代码来源:test_main.py
示例13: selftest
def selftest(logger):
selftest_started = time.perf_counter()
result = SelfTestResult()
test_suite = TestSuite()
for test_case in SELFTEST_CASES:
test_suite.addTest(defaultTestLoader.loadTestsFromTestCase(test_case))
test_suite.run(result)
result.log_results(logger)
successful_tests = result.successful_test_count()
count_mismatch = successful_tests != SELFTEST_COUNT
if result.wasSuccessful() and count_mismatch:
# only print this if all tests succeeded
logger.error("self test count (%d != %d) mismatch, either test discovery is broken or a test was added "
"without updating borg.selftest",
successful_tests, SELFTEST_COUNT)
if not result.wasSuccessful() or count_mismatch:
logger.error("self test failed\n"
"This is a bug either in Borg or in the package / distribution you use.")
sys.exit(2)
assert False, "sanity assertion failed: ran beyond sys.exit()"
selftest_elapsed = time.perf_counter() - selftest_started
logger.debug("%d self tests completed in %.2f seconds", successful_tests, selftest_elapsed)
开发者ID:JocelynDelalande,项目名称:borg,代码行数:22,代码来源:selftest.py
示例14: main
def main(path="."):
wasSuccessful = True
suites = TestSuite()
#path = os.path.abspath(path)
path = fs.absPath(path)
print "path='%s'" % path
if fs.split(path)[1]=="apps":
paths = []
#for file in os.listdir(path):
for file in fs.list(path):
#p = os.path.join(path, file)
p = fs.join(path, file)
#if os.path.isdir(p) and not file.startswith("."):
if fs.isDirectory(p) and not file.startswith("."):
paths.append(p)
else:
paths = [path]
for path in paths:
#No chdir method id FileSystem
os.chdir(path)
print "Processing '%s'" % path
testClasses = getAllTestClasses(path=path)
for filename, testClassName, testClass in testClasses:
suite = defaultTestLoader.loadTestsFromTestCase(testClass)
print "file='%s', class='%s', test=%s" % (filename, testClassName, suite.countTestCases())
#result = TextTestRunner(verbosity=1).run(suite)
#if not result.wasSuccessful:
# wasSuccessful = False
suites.addTest(suite)
result = TextTestRunner(verbosity=1).run(suites)
if result.wasSuccessful==False:
wasSuccessful = False
if wasSuccessful:
print "Completed all tests OK."
return True
else:
print "*** One or more tests Failed! ***"
return result
开发者ID:ptsefton,项目名称:integrated-content-environment,代码行数:38,代码来源:pyunit.py
示例15:
from unittest import defaultTestLoader
from TransactionManager import TransactionManagerBase
test_cases = [TransactionManagerBase]
tests = [defaultTestLoader.loadTestsFromTestCase(test) for test in test_cases]
开发者ID:char-lie,项目名称:software_design,代码行数:6,代码来源:__init__.py
示例16: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(testSrf2Fastq))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:5,代码来源:test_srf2fastq.py
示例17: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(SequenceFileTests))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:5,代码来源:test_sequences.py
示例18: suite
def suite():
suite = TestSuite()
suite.addTest(defaultTestLoader.loadTestsFromTestCase(TestInputState))
return suite
开发者ID:juntalis,项目名称:pycmd-fork,代码行数:4,代码来源:InputState_tests.py
示例19: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(TestRDFMagic))
return suite
开发者ID:detrout,项目名称:rdfmagic,代码行数:5,代码来源:test_rdfmagic.py
示例20: suite
def suite():
from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTest(defaultTestLoader.loadTestsFromTestCase(TestVersion))
return suite
开发者ID:detrout,项目名称:htsworkflow,代码行数:5,代码来源:test_version.py
注:本文中的unittest.defaultTestLoader.loadTestsFromTestCase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论