twisted.trial.runner.TestSuite

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 7

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)

Example 2

Project: mythbox Source File: test_runner.py
Function: test_empty
    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, [])

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()

Example 4

Project: mythbox Source File: test_script.py
Function: set_up
    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])

Example 5

Project: mythbox Source File: test_script.py
Function: test_untilfailuresuite
    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)

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)))

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)))

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)))

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)

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, [])

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)

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()])

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)

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)

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)))

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)))

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)))

Example 18

Project: mythbox Source File: mockcustomsuite.py
Function: test_suite
def test_suite():
    ts = runner.TestSuite()
    ts.name = "MyCustomSuite"
    return ts

Example 19

Project: mythbox Source File: mockcustomsuite2.py
Function: test_suite
def testSuite():
    ts = runner.TestSuite()
    ts.name = "MyCustomSuite"
    return ts

Example 20

Project: mythbox Source File: mockcustomsuite3.py
Function: test_suite
def test_suite():
    ts = runner.TestSuite()
    ts.name = "test_suite"
    return ts

Example 21

Project: mythbox Source File: mockcustomsuite3.py
Function: test_suite
def testSuite():
    ts = runner.TestSuite()
    ts.name = "testSuite"
    return ts