def test_list_goals(self): Phase.clear() self.assert_console_output(self._INSTALLED_HEADER) Goal(name=self._LIST_GOALS_NAME, action=ListGoals)\ .install().with_description(self._LIST_GOALS_DESC) self.assert_console_output( self._INSTALLED_HEADER, ' %s: %s' % (self._LIST_GOALS_NAME, self._LIST_GOALS_DESC), ) Goal(name=self._LLAMA_NAME, action=ListGoalsTest.LlamaTask)\ .install().with_description(self._LLAMA_DESC) self.assert_console_output( self._INSTALLED_HEADER, ' %s: %s' % (self._LIST_GOALS_NAME, self._LIST_GOALS_DESC), ' %s: %s' % (self._LLAMA_NAME, self._LLAMA_DESC), ) Goal(name=self._ALPACA_NAME, action=ListGoalsTest.AlpacaTask, dependencies=[self._LLAMA_NAME])\ .install() self.assert_console_output( self._INSTALLED_HEADER, ' %s: %s' % (self._LIST_GOALS_NAME, self._LIST_GOALS_DESC), ' %s: %s' % (self._LLAMA_NAME, self._LLAMA_DESC), )
def test_list_goals_graph(self): Phase.clear() Goal(name=self._LIST_GOALS_NAME, action=ListGoals)\ .install().with_description(self._LIST_GOALS_DESC) Goal(name=self._LLAMA_NAME, action=ListGoalsTest.LlamaTask)\ .install().with_description(self._LLAMA_DESC) Goal(name=self._ALPACA_NAME, action=ListGoalsTest.AlpacaTask, dependencies=[self._LLAMA_NAME])\ .install() self.assert_console_output( 'digraph G {\n rankdir=LR;\n graph [compound=true];', ' subgraph cluster_goals {\n node [style=filled];\n color = blue;\n label = "goals";', ' goals_goals [label="goals"];', ' }', ' subgraph cluster_llama {\n node [style=filled];\n color = blue;\n label = "llama";', ' llama_llama [label="llama"];', ' }', ' subgraph cluster_alpaca {\n node [style=filled];\n color = blue;\n label = "alpaca";', ' alpaca_alpaca [label="alpaca"];', ' }', ' alpaca_alpaca -> llama_llama [ltail=cluster_alpaca lhead=cluster_llama];', '}', args=['--test-graph'], )
def setUp(self): Phase.clear() self.real_build_root = BuildRoot().path self.build_root = os.path.realpath(mkdtemp(suffix='_BUILD_ROOT')) BuildRoot().path = self.build_root self.create_file('pants.ini') build_configuration = BuildConfiguration() build_configuration.register_aliases(self.alias_groups) self.build_file_parser = BuildFileParser(build_configuration, self.build_root) self.build_graph = BuildGraph()
def test_load_valid_partial_goals(self): def register_goals(): Phase('jack').install(Goal('jill', lambda: 42)) with self.create_register(register_goals=register_goals) as backend_package: Phase.clear() self.assertEqual(0, len(Phase.all())) load_backend(self.build_configuration, backend_package) self.assert_empty_aliases() self.assertEqual(1, len(Phase.all())) goals = Phase('jack').goals() self.assertEqual(1, len(goals)) goal = goals[0] self.assertEqual('jill', goal.name)
def tearDown(self): super(GoalTest, self).tearDown() Phase.clear()
def tearDown(self): Phase.clear()