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.
66 Examples
3
Example 1
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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
View licensedef 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 14
View licensedef 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 15
View licensedef 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 16
View licensedef 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 17
View licensedef 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 18
View licensedef 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 19
View licensedef 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 20
View licensedef 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 21
View licensedef 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 22
View licensedef test_visitEmptySuite(self): """ Test that C{visit} on an empty suite hits nothing. """ TestSuite().visit(self.visitor) self.assertEqual(self.visitor.calls, [])
3
Example 23
View licensedef 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 24
View licensedef 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 25
View licensedef 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 26
View licensedef 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 27
View licensedef 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 28
View licensedef 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 29
View licensedef 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 30
View licensedef 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 31
View licensedef 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 32
View licensedef 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 33
View licensedef 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)))
3
Example 34
View licensedef 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 35
View licensedef test_visitEmptySuite(self): """ Test that C{visit} on an empty suite hits nothing. """ TestSuite().visit(self.visitor) self.assertEqual(self.visitor.calls, [])
3
Example 36
View licensedef 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 37
View licensedef 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 38
View licensedef 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 39
View licensedef 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 40
View licensedef 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 41
View licensedef 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 42
View licensedef 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 43
View licensedef 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 44
View licensedef 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 45
View licensedef 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 46
View licensedef 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)))
3
Example 47
View licensedef 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 48
View licensedef test_visitEmptySuite(self): """ Test that C{visit} on an empty suite hits nothing. """ TestSuite().visit(self.visitor) self.assertEqual(self.visitor.calls, [])
3
Example 49
View licensedef 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 50
View licensedef 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()])