示例#1
0
 def _compile(commands: List[str], project_dir: str, dep_dir: str,
              compile_base_path: str, logger: Logger) -> None:
     for command in commands:
         dependencies = BuildCommand.create(command).execute(
             project_dir, logger)
         Compile.__copy_dependencies(dependencies, dep_dir,
                                     compile_base_path)
示例#2
0
    def test_execute_runs_command_with_args(self, shell_mock):
        command = "-command- -arg- --arg--"
        uut = BuildCommand.create(command)

        uut.execute("-project_dir-", self.logger)

        shell_mock.assert_called_with(command, cwd="-project_dir-", logger=ANY)
示例#3
0
    def test_quotes_args_for_execution(self, shell_mock):
        uut = BuildCommand.create("-command- 'arg 1'")

        uut.execute("-pdir-", self.logger)

        shell_mock.assert_called_with("-command- 'arg 1'",
                                      cwd="-pdir-", logger=ANY)
示例#4
0
    def test_execute_runs_command(self, shell_mock):
        uut = BuildCommand.create("-command-")

        uut.execute("-project_dir-", self.logger)

        shell_mock.assert_called_with("-command-",
                                      cwd="-project_dir-", logger=ANY)
示例#5
0
    def test_default_does_not_filter_output_on_error(self, shell_mock):
        shell_mock.side_effect = CommandFailedError("-command-", "-output-")
        uut = BuildCommand.create("-some_command-")

        try:
            uut.execute("-project_dir-", self.logger)
        except CommandFailedError as e:
            assert_equals("\n-output-", e.output)
示例#6
0
    def test_raises_on_error(self, shell_mock):
        shell_mock.side_effect = CommandFailedError("-command-", "-output-")
        uut = BuildCommand.create("-some_command-")

        assert_raises(CommandFailedError, uut.execute, "-p-", self.logger)
示例#7
0
    def test_quoted_args_are_saved_without_quotes(self):
        uut = BuildCommand.create("-some_command- 'arg 1' \"arg 2\"")

        assert_equals(["arg 1", "arg 2"], uut.args)
示例#8
0
    def test_saves_args(self):
        uut = BuildCommand.create("-some_command- arg1 arg2")

        assert_equals(["arg1", "arg2"], uut.args)
示例#9
0
 def test_has_no_dependencies_by_default(self):
     uut = BuildCommand.create("-some_command-")
     assert not uut._get_dependencies("-output-", "-project_dir-",
                                      self.logger)
示例#10
0
    def test_generic_command_returns_base_implementation(self):
        uut = BuildCommand.create("-some_command-")

        assert_is_instance(uut, BuildCommand)
        assert_equals("-some_command-", uut._name)
示例#11
0
 def test_get_correct_command(self):
     actual = BuildCommand.create(BuildCommandTestImpl.TEST_COMMAND)
     assert_is_instance(actual, BuildCommandTestImpl)