Пример #1
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)
Пример #2
0
 def test_subsystems(self):
   def global_subsystems():
     return {DummySubsystem1, DummySubsystem2}
   with self.create_register(global_subsystems=global_subsystems) as backend_package:
     load_backend(self.build_configuration, backend_package)
     self.assertEqual(self.build_configuration.subsystem_types(),
                      {DummySubsystem1, DummySubsystem2})
Пример #3
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)
Пример #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'])
Пример #5
0
 def test_load_valid_partial_aliases(self):
     aliases = BuildFileAliases(targets={"bob": DummyTarget}, objects={"obj1": DummyObject1, "obj2": DummyObject2})
     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(DummyTarget, registered_aliases.target_types["bob"])
         self.assertEqual(DummyObject1, registered_aliases.objects["obj1"])
         self.assertEqual(DummyObject2, registered_aliases.objects["obj2"])
         self.assertEqual(self.build_configuration.subsystems(), {DummySubsystem1, DummySubsystem2})
Пример #6
0
    def test_subsystems(self):
        def global_subsystems():
            return {DummySubsystem1, DummySubsystem2}

        with self.create_register(
                global_subsystems=global_subsystems) as backend_package:
            load_backend(self.build_configuration, backend_package)
            self.assertEqual(self.build_configuration.subsystems(),
                             {DummySubsystem1, DummySubsystem2})
Пример #7
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'])
Пример #8
0
 def test_load_valid_partial_aliases(self):
   aliases = BuildFileAliases.create(targets={'bob': DummyTarget},
                                     objects={'obj1': DummyObject1,
                                              'obj2': DummyObject2})
   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(DummyTarget, registered_aliases.targets['bob'])
     self.assertEqual(DummyObject1, registered_aliases.objects['obj1'])
     self.assertEqual(DummyObject2, registered_aliases.objects['obj2'])
     self.assertEqual(self.build_configuration.subsystem_types(),
                      set([DummySubsystem1, DummySubsystem2]))
Пример #9
0
 def test_load_valid_partial_aliases(self):
     aliases = BuildFileAliases.create(targets={'bob': DummyTarget},
                                       objects={
                                           'obj1': DummyObject1,
                                           'obj2': DummyObject2
                                       })
     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(DummyTarget, registered_aliases.targets['bob'])
         self.assertEqual(DummyObject1, registered_aliases.objects['obj1'])
         self.assertEqual(DummyObject2, registered_aliases.objects['obj2'])
         self.assertEqual(self.build_configuration.subsystems(),
                          set([DummySubsystem1, DummySubsystem2]))
Пример #10
0
  def test_load_valid_partial_goals(self):
    def register_goals():
      Goal.by_name('jack').install(TaskRegistrar('jill', DummyTask))

    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)
Пример #11
0
    def test_load_valid_partial_goals(self):
        def register_goals():
            Goal.by_name('jack').install(TaskRegistrar('jill', DummyTask))

        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)
Пример #12
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)
Пример #13
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()
Пример #14
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)
Пример #15
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()