def test_simple(self): scheduler = CommandScheduler() scheduler.set_before("task2", "task1") scheduler.set_after("task2", "task3") scheduler.set_after("task2", "task4") scheduler.set_before("task4", "task3") tasks = scheduler.order("task4") self.assertEqual(tasks, ["task1", "task2", "task3"])
def test_cycle(self): scheduler = CommandScheduler() scheduler.set_before("task2", "task1") scheduler.set_before("task1", "task2") self.assertRaises(ValueError, lambda: scheduler.order("task1"))
CachedPackage from bentomakerlib.help \ import \ get_usage if os.environ.get("BENTOMAKER_DEBUG", "0") != "0": BENTOMAKER_DEBUG = True else: BENTOMAKER_DEBUG = False SCRIPT_NAME = 'bentomaker' CONTEXT_REGISTRY = ContextRegistry() CMD_SCHEDULER = CommandScheduler() CMD_SCHEDULER.set_before("build", "configure") CMD_SCHEDULER.set_before("build_egg", "build") CMD_SCHEDULER.set_before("build_wininst", "build") CMD_SCHEDULER.set_before("install", "build") # Path relative to build directory CMD_DATA_DUMP = os.path.join(_SUB_BUILD_DIR, "cmd_data.db") # FIXME: those private functions hiding global variables are horrible - they # are a dirty workaround until a better solution to pass nodes to the # underlying implementation is found (Node instances can only be created once # the source and build directories are known) __CMD_DATA_STORE = None def _get_cmd_data_provider(dump_node): global __CMD_DATA_STORE if __CMD_DATA_STORE is None: