本文整理汇总了Python中twisted.trial.test.test_loader.testNames函数的典型用法代码示例。如果您正苦于以下问题:Python testNames函数的具体用法?Python testNames怎么用?Python testNames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了testNames函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: assertSuitesEqual
def assertSuitesEqual(self, test1, names):
loader = runner.TestLoader()
names1 = testNames(test1)
names2 = testNames(runner.TestSuite(map(loader.loadByName, names)))
names1.sort()
names2.sort()
self.assertEqual(names1, names2)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:7,代码来源:test_script.py
示例2: test_preserveArgumentOrder
def test_preserveArgumentOrder(self):
"""
Multiple tests passed on the command line are not reordered.
"""
tests = [
"twisted.trial.test.test_tests",
"twisted.trial.test.test_assertions",
"twisted.trial.test.test_deferreds",
]
self.config.parseOptions(tests)
suite = trial._getSuite(self.config)
names = testNames(suite)
expectedSuite = TestSuite(map(self.loader.loadByName, tests))
expectedNames = testNames(expectedSuite)
self.assertEqual(names, expectedNames)
开发者ID:AlexanderHerlan,项目名称:syncpy,代码行数:18,代码来源:test_script.py
示例3: test_alphabeticalPackage
def test_alphabeticalPackage(self):
"""
--order=alphabetical causes trial to run test modules within a given
package alphabetically, with tests within each module alphabetized.
"""
self.config.parseOptions([
"--order", "alphabetical", "twisted.trial.test"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
names = testNames(suite)
self.assertTrue(names, msg="Failed to load any tests!")
self.assertEqual(names, sorted(names))
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:13,代码来源:test_script.py
示例4: test_toptobottomPackage
def test_toptobottomPackage(self):
"""
--order=toptobottom causes trial to run test modules within a given
package alphabetically, with tests within each module run top to
bottom.
"""
self.config.parseOptions([
"--order", "toptobottom", "twisted.trial.test"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
names = testNames(suite)
# twisted.trial.test.test_module, so split and key on the first 4 to
# get stable alphabetical sort on those
self.assertEqual(
names, sorted(names, key=lambda name : name.split(".")[:4]),
)
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:17,代码来源:test_script.py
示例5: test_toptobottomModule
def test_toptobottomModule(self):
"""
--order=toptobottom causes trial to run test classes within a given
module from top to bottom as they are defined in the module's source.
"""
self.config.parseOptions([
"--order", "toptobottom", "twisted.trial.test.ordertests"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
self.assertEqual(
testNames(suite), [
'twisted.trial.test.ordertests.FooTest.test_first',
'twisted.trial.test.ordertests.FooTest.test_second',
'twisted.trial.test.ordertests.FooTest.test_third',
'twisted.trial.test.ordertests.FooTest.test_fourth',
'twisted.trial.test.ordertests.BazTest.test_baz',
'twisted.trial.test.ordertests.BarTest.test_bar'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py
示例6: test_alphabeticalModule
def test_alphabeticalModule(self):
"""
--order=alphabetical causes trial to run test classes within a given
module alphabetically.
"""
self.config.parseOptions([
"--order", "alphabetical", "twisted.trial.test.ordertests"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
self.assertEqual(
testNames(suite), [
'twisted.trial.test.ordertests.BarTest.test_bar',
'twisted.trial.test.ordertests.BazTest.test_baz',
'twisted.trial.test.ordertests.FooTest.test_first',
'twisted.trial.test.ordertests.FooTest.test_fourth',
'twisted.trial.test.ordertests.FooTest.test_second',
'twisted.trial.test.ordertests.FooTest.test_third'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py
示例7: test_alphabetical
def test_alphabetical(self):
"""
--order=alphabetical causes trial to run tests alphabetically within
each test case.
"""
self.config.parseOptions([
"--order", "alphabetical",
"twisted.trial.test.ordertests.FooTest"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
self.assertEqual(
testNames(suite), [
'twisted.trial.test.ordertests.FooTest.test_first',
'twisted.trial.test.ordertests.FooTest.test_fourth',
'twisted.trial.test.ordertests.FooTest.test_second',
'twisted.trial.test.ordertests.FooTest.test_third'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:18,代码来源:test_script.py
示例8: test_toptobottom
def test_toptobottom(self):
"""
--order=toptobottom causes trial to run test methods within a given
test case from top to bottom as they are defined in the body of the
class.
"""
self.config.parseOptions([
"--order", "toptobottom",
"twisted.trial.test.ordertests.FooTest"])
loader = trial._getLoader(self.config)
suite = loader.loadByNames(self.config['tests'])
self.assertEqual(
testNames(suite), [
'twisted.trial.test.ordertests.FooTest.test_first',
'twisted.trial.test.ordertests.FooTest.test_second',
'twisted.trial.test.ordertests.FooTest.test_third',
'twisted.trial.test.ordertests.FooTest.test_fourth'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:19,代码来源:test_script.py
示例9: test_toptobottomMissingSource
def test_toptobottomMissingSource(self):
"""
--order=toptobottom detects the source line of methods from modules
whose source file is missing.
"""
tempdir = self.mktemp()
package = FilePath(tempdir).child('twisted_toptobottom_temp')
package.makedirs()
package.child('__init__.py').setContent(b'')
package.child('test_missing.py').setContent(textwrap.dedent('''
from twisted.trial.unittest import TestCase
class TestMissing(TestCase):
def test_second(self): pass
def test_third(self): pass
def test_fourth(self): pass
def test_first(self): pass
''').encode('utf8'))
pathEntry = package.parent().path
sys.path.insert(0, pathEntry)
self.addCleanup(sys.path.remove, pathEntry)
from twisted_toptobottom_temp import test_missing
self.addCleanup(sys.modules.pop, 'twisted_toptobottom_temp')
self.addCleanup(sys.modules.pop, test_missing.__name__)
package.child('test_missing.py').remove()
self.config.parseOptions([
"--order", "toptobottom", "twisted.trial.test.ordertests"])
loader = trial._getLoader(self.config)
suite = loader.loadModule(test_missing)
self.assertEqual(
testNames(suite), [
'twisted_toptobottom_temp.test_missing.TestMissing.test_second',
'twisted_toptobottom_temp.test_missing.TestMissing.test_third',
'twisted_toptobottom_temp.test_missing.TestMissing.test_fourth',
'twisted_toptobottom_temp.test_missing.TestMissing.test_first'])
开发者ID:andywu42000,项目名称:2016YCProject,代码行数:36,代码来源:test_script.py
示例10: test_testNames
def test_testNames(self):
"""
Check that the testNames helper method accurately collects the
names of tests in suite.
"""
self.assertEqual(testNames(self), [self.id()])
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:6,代码来源:test_script.py
注:本文中的twisted.trial.test.test_loader.testNames函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论