Here are the examples of the python api twisted.trial.runner.TestSuite taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
21 Examples
3
Example 1
Project: mythbox Source File: test_loader.py
def test_loadDifferentNames(self):
"""
Check that loadByNames loads all the names that it is given
"""
modules = ['goodpackage', 'package.test_module']
suite1 = self.loader.loadByNames(modules)
suite2 = runner.TestSuite(map(self.loader.loadByName, modules))
self.assertSuitesEqual(suite1, suite2)
3
Example 2
def test_empty(self):
"""
If there are no tests, the reporter should not receive any events to
report.
"""
result = self.runner.run(runner.TestSuite())
self.assertEqual(result._calls, [])
3
Example 3
Project: mythbox Source File: test_runner.py
def makeTestFixtures(self):
class MockTest(unittest.TestCase):
def test_foo(test):
self.log.append('test_foo')
self.test = MockTest('test_foo')
self.suite = runner.TestSuite()
3
Example 4
def setUp(self):
self.config = trial.Options()
self.log = []
self.patch(gc, 'collect', self.collect)
test = pyunit.FunctionTestCase(self.simpleTest)
self.test = runner.TestSuite([test, test])
3
Example 5
def test_untilFailureSuite(self):
"""
The C{until-failure} configuration uses the L{runner.TestSuite} to keep
instances alive across runs.
"""
self.config['until-failure'] = True
loader = trial._getLoader(self.config)
self.assertEquals(loader.suiteFactory, runner.TestSuite)
3
Example 6
Project: mythbox Source File: test_tests.py
def test_iterateSingletonTestSuite(self):
"""
L{_iterateTests} on a test suite that contains a single test case
returns a list containing that test case.
"""
test = unittest.TestCase()
suite = runner.TestSuite([test])
self.assertEqual([test], list(unittest._iterateTests(suite)))
3
Example 7
Project: mythbox Source File: test_tests.py
def test_iterateNestedTestSuite(self):
"""
L{_iterateTests} returns tests that are in nested test suites.
"""
test = unittest.TestCase()
suite = runner.TestSuite([runner.TestSuite([test])])
self.assertEqual([test], list(unittest._iterateTests(suite)))
3
Example 8
Project: mythbox Source File: test_tests.py
def test_iterateIsLeftToRightDepthFirst(self):
"""
L{_iterateTests} returns tests in left-to-right, depth-first order.
"""
test = unittest.TestCase()
suite = runner.TestSuite([runner.TestSuite([test]), self])
self.assertEqual([test, self], list(unittest._iterateTests(suite)))
3
Example 9
Project: mythbox Source File: test_test_visitor.py
def test_visitSuite(self):
"""
Test that C{visit} hits all tests in a suite.
"""
tests = [TestTestVisitor('test_visitCase'),
TestTestVisitor('test_visitSuite')]
testSuite = TestSuite(tests)
testSuite.visit(self.visitor)
self.assertEqual(self.visitor.calls, tests)
3
Example 10
Project: mythbox Source File: test_test_visitor.py
def test_visitEmptySuite(self):
"""
Test that C{visit} on an empty suite hits nothing.
"""
TestSuite().visit(self.visitor)
self.assertEqual(self.visitor.calls, [])
3
Example 11
Project: mythbox Source File: test_test_visitor.py
def test_visitNestedSuite(self):
"""
Test that C{visit} recurses through suites.
"""
tests = [TestTestVisitor('test_visitCase'),
TestTestVisitor('test_visitSuite')]
testSuite = TestSuite([TestSuite([test]) for test in tests])
testSuite.visit(self.visitor)
self.assertEqual(self.visitor.calls, tests)
3
Example 12
Project: mythbox Source File: test_test_visitor.py
def test_visitPyunitCase(self):
"""
Test that a stdlib test case in a suite gets visited.
"""
class PyunitCase(pyunit.TestCase):
def test_foo(self):
pass
test = PyunitCase('test_foo')
TestSuite([test]).visit(self.visitor)
self.assertEqual(
[call.id() for call in self.visitor.calls], [test.id()])
3
Example 13
Project: SubliminalCollaborator Source File: test_loader.py
def test_loadInheritedMethods(self):
"""
Check that test methods names which are inherited from are all
loaded rather than just one.
"""
methods = ['inheritancepackage.test_x.A.test_foo',
'inheritancepackage.test_x.B.test_foo']
suite1 = self.loader.loadByNames(methods)
suite2 = runner.TestSuite(map(self.loader.loadByName, methods))
self.assertSuitesEqual(suite1, suite2)
3
Example 14
Project: SubliminalCollaborator Source File: test_script.py
def test_untilFailureSuite(self):
"""
The C{until-failure} configuration uses the L{runner.TestSuite} to keep
instances alive across runs.
"""
self.config['until-failure'] = True
loader = trial._getLoader(self.config)
self.assertEqual(loader.suiteFactory, runner.TestSuite)
3
Example 15
Project: SubliminalCollaborator Source File: test_tests.py
def test_iterateSingletonTestSuite(self):
"""
L{_iterateTests} on a test suite that contains a single test case
returns a list containing that test case.
"""
test = self.TestCase()
suite = runner.TestSuite([test])
self.assertEqual([test], list(unittest._iterateTests(suite)))
3
Example 16
Project: SubliminalCollaborator Source File: test_tests.py
def test_iterateNestedTestSuite(self):
"""
L{_iterateTests} returns tests that are in nested test suites.
"""
test = self.TestCase()
suite = runner.TestSuite([runner.TestSuite([test])])
self.assertEqual([test], list(unittest._iterateTests(suite)))
3
Example 17
Project: SubliminalCollaborator Source File: test_tests.py
def test_iterateIsLeftToRightDepthFirst(self):
"""
L{_iterateTests} returns tests in left-to-right, depth-first order.
"""
test = self.TestCase()
suite = runner.TestSuite([runner.TestSuite([test]), self])
self.assertEqual([test, self], list(unittest._iterateTests(suite)))
0
Example 18
def test_suite():
ts = runner.TestSuite()
ts.name = "MyCustomSuite"
return ts
0
Example 19
def testSuite():
ts = runner.TestSuite()
ts.name = "MyCustomSuite"
return ts
0
Example 20
def test_suite():
ts = runner.TestSuite()
ts.name = "test_suite"
return ts
0
Example 21
def testSuite():
ts = runner.TestSuite()
ts.name = "testSuite"
return ts