Пример #1
0
 def test_simple_sort(self):
     from proboscis.case import TestPlan
     from proboscis.sorting import TestGraph
     from proboscis import TestRegistry
     registry = TestRegistry()
     registry.register(N2, groups=["blah"], depends_on_classes=[N11])
     registry.register(N3, depends_on_classes=[N11, N2])
     registry.register(N7, depends_on_groups=["blah"])
     registry.register(N11)
     cases = TestPlan.create_cases(registry.tests, [])
     graph = TestGraph(registry.groups, registry.tests, cases)
     sorted_entries = graph.sort()
     result = list(case.entry.home for case in sorted_entries)
Пример #2
0
    def test_simple_sort(self):
        from proboscis.case import TestPlan
        from proboscis.sorting import TestGraph
        from proboscis import TestRegistry

        registry = TestRegistry()
        registry.register(N2, groups=["blah"], depends_on_classes=[N11])
        registry.register(N3, depends_on_classes=[N11, N2])
        registry.register(N7, depends_on_groups=["blah"])
        registry.register(N11)
        cases = TestPlan.create_cases(registry.tests, [])
        graph = TestGraph(registry.groups, registry.tests, cases)
        sorted_entries = graph.sort()
        result = list(case.entry.home for case in sorted_entries)
        expected = [N11, N2, N3, N7]
        self.assertEqual(4, len(result))
        self.assertEqual(N11, result[0])
        self.assertEqual(N2, result[1])
        self.assertTrue((result[2] == N3 and result[3] == N7) or (result[2] == N7 or result[3] == N2))
Пример #3
0
    def test_complex_sort(self):
        from proboscis.case import TestPlan
        from proboscis.sorting import TestGraph
        from proboscis import TestRegistry

        registry = TestRegistry()
        registry.register(N2, depends_on_classes=[N11])
        registry.register(N3)
        registry.register(N5)
        registry.register(N7)
        registry.register(N8, depends_on_classes=[N3])
        registry.register(N9, depends_on_classes=[N8, N11])
        registry.register(N10, depends_on_classes=[N3, N11])
        registry.register(N11, depends_on_classes=[N5, N7])
        cases = TestPlan.create_cases(registry.tests, [])
        graph = TestGraph(registry.groups, registry.tests, cases)
        result = graph.sort()
        self.assertEqual(8, len(result))
        msg = assert_sort_order_is_correct(result)
        self.assertEqual(None, msg)
Пример #4
0
    def test_complex_sort(self):
        from proboscis.case import TestPlan
        from proboscis.sorting import TestGraph
        from proboscis import TestRegistry

        registry = TestRegistry()
        registry.register(N2, depends_on_classes=[N11])
        registry.register(N3)
        registry.register(N5)
        registry.register(N7)
        registry.register(N8, depends_on_classes=[N3])
        registry.register(N9, depends_on_classes=[N8, N11])
        registry.register(N10, depends_on_classes=[N3, N11])
        registry.register(N11, depends_on_classes=[N5, N7])
        cases = TestPlan.create_cases(registry.tests, [])
        graph = TestGraph(registry.groups, registry.tests, cases)
        result = graph.sort()
        self.assertEqual(8, len(result))
        msg = assert_sort_order_is_correct(result)
        self.assertEqual(None, msg)
Пример #5
0
    def test_do_not_allow_sneaky_cycle(self):
        from proboscis.case import TestPlan
        from proboscis.sorting import TestGraph
        from proboscis import TestRegistry

        registry = TestRegistry()
        registry.register(N2, depends_on_classes=[N11])
        registry.register(N3)
        registry.register(N5, depends_on_groups=["something"])
        registry.register(N7)
        registry.register(N8, depends_on_classes=[N3])
        registry.register(N9, depends_on_classes=[N8, N11])
        registry.register(N10, depends_on_classes=[N3, N11])
        registry.register(N11, groups=["something"], depends_on_classes=[N5, N7])
        cases = TestPlan.create_cases(registry.tests, [])
        graph = TestGraph(registry.groups, registry.tests, cases)

        re = compatability.capture_exception(graph.sort, RuntimeError)
        self.assertTrue(re is not None)
        self.assertTrue(isinstance(re, RuntimeError))
        self.assertTrue(str(re).find("Cycle found") >= 0)
Пример #6
0
    def test_do_not_allow_sneaky_cycle(self):
        from proboscis.case import TestPlan
        from proboscis.sorting import TestGraph
        from proboscis import TestRegistry

        registry = TestRegistry()
        registry.register(N2, depends_on_classes=[N11])
        registry.register(N3)
        registry.register(N5, depends_on_groups=["something"])
        registry.register(N7)
        registry.register(N8, depends_on_classes=[N3])
        registry.register(N9, depends_on_classes=[N8, N11])
        registry.register(N10, depends_on_classes=[N3, N11])
        registry.register(N11,
                          groups=["something"],
                          depends_on_classes=[N5, N7])
        cases = TestPlan.create_cases(registry.tests, [])
        graph = TestGraph(registry.groups, registry.tests, cases)

        re = compatability.capture_exception(graph.sort, RuntimeError)
        self.assertTrue(re is not None)
        self.assertTrue(isinstance(re, RuntimeError))
        self.assertTrue(str(re).find("Cycle found") >= 0)