예제 #1
0
 def test_should_not_allow_classes_to_depend_on_self(self):
     from proboscis import TestRegistry
     registry = TestRegistry()
     try:
         registry.register(N2, depends_on_classes=[N2])
         self.fail("Expected runtime error.")
     except RuntimeError:
         pass
예제 #2
0
 def test_should_not_allow_classes_to_depend_on_self(self):
     from proboscis import TestRegistry
     registry = TestRegistry()
     try:
         registry.register(N2, depends_on_classes=[N2])
         self.fail("Expected runtime error.")
     except RuntimeError:
         pass
예제 #3
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)
예제 #4
0
    def setUp(self):
        import proboscis
        from tests.unit import proboscis_example
        from proboscis.case import TestPlan
        from proboscis import TestRegistry

        old_default_registry = proboscis.decorators.DEFAULT_REGISTRY
        proboscis.decorators.DEFAULT_REGISTRY = TestRegistry()
        compatability.reload(proboscis_example)
        self.registry = proboscis.decorators.DEFAULT_REGISTRY
        proboscis.default_registry = old_default_registry
        self.plan = TestPlan.create_from_registry(self.registry)
예제 #5
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))
예제 #6
0
 def setUp(self):
     import proboscis
     from proboscis import TestRegistry
     self.old_default_registry = proboscis.decorators.DEFAULT_REGISTRY
     self.registry = TestRegistry()
     proboscis.decorators.DEFAULT_REGISTRY = self.registry
예제 #7
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)
예제 #8
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)
예제 #9
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)
예제 #10
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)