Exemple #1
0
    def test_multiple_nodes(self):
        number_of_nodes = 10
        wp = WorkProvider()
        nodes = [MockWorkNode]
        for i in range(0, number_of_nodes):
            node = MockWorkNode()
            node.i = i
            nodes.append(node)
        wp.add_nodes(*nodes)

        for i in range(0, number_of_nodes):
            node = wp.get_next_node()
            self.assertEqual(node.i, nodes[i].i)
    def test_multiple_nodes(self):
        number_of_nodes = 10
        wp = WorkProvider()
        nodes = [MockWorkNode]
        for i in range(0, number_of_nodes):
            node = MockWorkNode()
            node.i = i
            nodes.append(node)
        wp.add_nodes(*nodes)

        for i in range(0, number_of_nodes):
            node = wp.get_next_node()
            self.assertEqual(node.i, nodes[i].i)
    def add_tests(self, test_json):
        """Takes a list of tests in the format required by the configuration file 
        and adds them to the tests that this TestRunner will run."""
        configuration = test_json['configuration']
        for thread in test_json['tests']:
            work_provider = WorkProvider() 
            work_nodes = []
            for test in thread:
                test_obj = {
                    'test': test,
                    'configuration': configuration,
                    'environment': {},
                }
                work_nodes.extend(TestLoader.get_work_nodes_for_test(test_obj))

            work_provider.add_nodes(*work_nodes)
            self.work_providers.append(work_provider)
    def add_tests(self, test_json):
        """Takes a list of tests in the format required by the configuration file 
        and adds them to the tests that this TestRunner will run."""
        configuration = test_json['configuration']
        for thread in test_json['tests']:
            work_provider = WorkProvider()
            work_nodes = []
            for test in thread:
                test_obj = {
                    'test': test,
                    'configuration': configuration,
                    'environment': {},
                }
                work_nodes.extend(TestLoader.get_work_nodes_for_test(test_obj))

            work_provider.add_nodes(*work_nodes)
            self.work_providers.append(work_provider)
Exemple #5
0
    def test_has_failed_ex_groups(self):
        wp = WorkProvider()
        env = {'env': 'env'}

        # Same class, no failed ex groups
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env,
                                              wp))
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env,
                                              wp))

        # Same class, with failed class ex groups
        wp.add_failed_ex_groups([1], env)

        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env,
                                              wp))
        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env,
                                              wp))

        # Same class, no ex groups, with wp.failed_ex_groups reset
        wp = WorkProvider()

        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env,
                                              wp))
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env,
                                              wp))

        # Same class, with one method having a failed ex_group
        wp.add_failed_ex_groups([2], env)

        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture2, Fixture2.meth1, env,
                                              wp))
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture2, Fixture2.meth2, env,
                                              wp))
    def test_has_failed_ex_groups(self):
        wp = WorkProvider()
        env = { 'env': 'env' }

        # Same class, no failed ex groups
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env, wp)
        )
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env, wp)
        )

        # Same class, with failed class ex groups
        wp.add_failed_ex_groups([1], env)

        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env, wp)
        )
        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env, wp)
        )

        # Same class, no ex groups, with wp.failed_ex_groups reset
        wp = WorkProvider()

        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth1, env, wp)
        )
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture1, Fixture1.meth2, env, wp)
        )

        # Same class, with one method having a failed ex_group
        wp.add_failed_ex_groups([2], env)

        self.assertTrue(
            WorkerThread.has_failed_ex_groups(Fixture2, Fixture2.meth1, env, wp)
        )
        self.assertFalse(
            WorkerThread.has_failed_ex_groups(Fixture2, Fixture2.meth2, env, wp)
        )
 def test_empty_work_pool(self):
     wp = WorkProvider()
     self.assertIsNone(wp.get_next_node())
 def test_single_node(self):
     wp = WorkProvider()
     node = MockWorkNode()
     wp.add_nodes(node)
     self.assertEqual(node, wp.get_next_node())
 def test_empty_work(self):
     wp = WorkProvider()
     self.assertEqual(None, wp.get_next_node())
Exemple #10
0
 def test_single_node(self):
     wp = WorkProvider()
     node = MockWorkNode()
     wp.add_nodes(node)
     self.assertEqual(node, wp.get_next_node())
Exemple #11
0
 def test_empty_work(self):
     wp = WorkProvider()
     self.assertEqual(None, wp.get_next_node())
Exemple #12
0
 def test_empty_work_pool(self):
     wp = WorkProvider()
     self.assertIsNone(wp.get_next_node())