def test_detect_cycle_direct(self): a = MockTarget('a') # no cycles yet InternalTarget.sort_targets([a]) a.internal_dependencies = [a] try: InternalTarget.sort_targets([a]) self.fail("Expected a cycle to be detected") except InternalTarget.CycleException: # expected pass
def testDetectIndirect(self): c = MockTarget('c') b = MockTarget('b', [ c ]) a = MockTarget('a', [ c, b ]) # no cycles yet InternalTarget.sort_targets([a]) c.internal_dependencies = [a] try: InternalTarget.sort_targets([a]) self.fail("Expected a cycle to be detected") except InternalTarget.CycleException: # expected pass