def test_load_valid_partial_aliases(self):
     aliases = BuildFileAliases.create(targets={"bob": Target}, objects={"MEANING_OF_LIFE": 42})
     with self.create_register(build_file_aliases=lambda: aliases) as backend_package:
         load_backend(self.build_configuration, backend_package)
         registered_aliases = self.build_configuration.registered_aliases()
         self.assertEqual(Target, registered_aliases.targets["bob"])
         self.assertEqual(42, registered_aliases.objects["MEANING_OF_LIFE"])
Exemple #2
0
  def test_load_invalid_entrypoint(self):
    def build_file_aliases(bad_arg):
      return BuildFileAliases.create()

    with self.create_register(build_file_aliases=build_file_aliases) as backend_package:
      with self.assertRaises(BuildConfigurationError):
        load_backend(self.build_configuration, backend_package)
    def test_load_invalid_entrypoint(self):
        def build_file_aliases(bad_arg):
            return BuildFileAliases.create()

        with self.create_register(build_file_aliases=build_file_aliases) as backend_package:
            with self.assertRaises(BuildConfigurationError):
                load_backend(self.build_configuration, backend_package)
Exemple #4
0
 def test_load_valid_partial_aliases(self):
   aliases = BuildFileAliases.create(targets={'bob': Target},
                                     objects={'MEANING_OF_LIFE': 42})
   with self.create_register(build_file_aliases=lambda: aliases) as backend_package:
     load_backend(self.build_configuration, backend_package)
     registered_aliases = self.build_configuration.registered_aliases()
     self.assertEqual(Target, registered_aliases.targets['bob'])
     self.assertEqual(42, registered_aliases.objects['MEANING_OF_LIFE'])
    def test_load_valid_partial_goals(self):
        def register_goals():
            Goal.by_name("jack").install(TaskRegistrar("jill", lambda: 42))

        with self.create_register(register_goals=register_goals) as backend_package:
            Goal.clear()
            self.assertEqual(0, len(Goal.all()))

            load_backend(self.build_configuration, backend_package)
            self.assert_empty_aliases()
            self.assertEqual(1, len(Goal.all()))

            task_names = Goal.by_name("jack").ordered_task_names()
            self.assertEqual(1, len(task_names))

            task_name = task_names[0]
            self.assertEqual("jill", task_name)
  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)
Exemple #7
0
  def test_load_valid_partial_goals(self):
    def register_goals():
      Goal.by_name('jack').install(TaskRegistrar('jill', lambda: 42))

    with self.create_register(register_goals=register_goals) as backend_package:
      Goal.clear()
      self.assertEqual(0, len(Goal.all()))

      load_backend(self.build_configuration, backend_package)
      self.assert_empty_aliases()
      self.assertEqual(1, len(Goal.all()))

      task_names = Goal.by_name('jack').ordered_task_names()
      self.assertEqual(1, len(task_names))

      task_name = task_names[0]
      self.assertEqual('jill', task_name)
 def test_load_valid_empty(self):
     with self.create_register() as backend_package:
         load_backend(self.build_configuration, backend_package)
         self.assert_empty_aliases()
 def test_load_invalid_module(self):
     with self.create_register(module_name="register2") as backend_package:
         with self.assertRaises(BuildConfigurationError):
             load_backend(self.build_configuration, backend_package)
Exemple #10
0
 def test_load_valid_empty(self):
   with self.create_register() as backend_package:
     load_backend(self.build_configuration, backend_package)
     self.assert_empty_aliases()
Exemple #11
0
 def test_load_invalid_module(self):
   with self.create_register(module_name='register2') as backend_package:
     with self.assertRaises(BuildConfigurationError):
       load_backend(self.build_configuration, backend_package)