Beispiel #1
0
 def test_raises_exception_if_retcode_not_0(self):
     self.popen = FakePopen(retcode=1, err=b"Some Error Message")
     self.os_utils.popen.side_effect = [self.popen]
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
     with self.assertRaises(GradleExecutionError) as err:
         gradle.build(self.source_dir, self.manifest_path)
     self.assertEquals(err.exception.args[0], "Gradle Failed: Some Error Message")
Beispiel #2
0
 def test_no_build_file_throws(self):
     self.os_utils.exists.side_effect = lambda d: False
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
     with self.assertRaises(BuildFileNotFoundError) as raised:
         gradle.build(self.source_dir, self.manifest_path)
     self.assertEquals(
         raised.exception.args[0], "Gradle Failed: Gradle build file not found: %s" % self.manifest_path
     )
Beispiel #3
0
 def test_build_with_init_script(self):
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
     gradle.build(self.source_dir, self.manifest_path, init_script_path=self.init_script)
     self.os_utils.popen.assert_called_with(
         [self.gradle_path, "build", "--build-file", self.manifest_path, "--init-script", self.init_script],
         cwd=self.source_dir,
         stderr=subprocess.PIPE,
         stdout=subprocess.PIPE,
     )
Beispiel #4
0
 def test_gradlew_path_is_dummy_uses_gradle_binary(self):
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
     gradle.build(self.source_dir, self.manifest_path)
     self.os_utils.popen.assert_called_with(
         [self.gradle_path, "build", "--build-file", self.manifest_path],
         cwd=self.source_dir,
         stderr=subprocess.PIPE,
         stdout=subprocess.PIPE,
     )
 def test_build_no_init_script(self):
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary,
                               os_utils=self.os_utils)
     gradle.build(self.source_dir, self.manifest_path)
     self.os_utils.popen.assert_called_with(
         [self.gradle_path, 'build', '--build-file', self.manifest_path],
         cwd=self.source_dir,
         stderr=subprocess.PIPE,
         stdout=subprocess.PIPE)
 def test_includes_build_properties_in_command(self):
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary,
                               os_utils=self.os_utils)
     gradle.build(self.source_dir,
                  self.manifest_path,
                  init_script_path=self.init_script,
                  properties={'foo': 'bar'})
     self.os_utils.popen.assert_called_with([
         self.gradle_path, 'build', '--build-file', self.manifest_path,
         '-Dfoo=bar', '--init-script', self.init_script
     ],
                                            cwd=self.source_dir,
                                            stderr=subprocess.PIPE,
                                            stdout=subprocess.PIPE)
Beispiel #7
0
 def test_includes_build_properties_in_command(self):
     gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
     gradle.build(self.source_dir, self.manifest_path, init_script_path=self.init_script, properties={"foo": "bar"})
     self.os_utils.popen.assert_called_with(
         [
             self.gradle_path,
             "build",
             "--build-file",
             self.manifest_path,
             "-Dfoo=bar",
             "--init-script",
             self.init_script,
         ],
         cwd=self.source_dir,
         stderr=subprocess.PIPE,
         stdout=subprocess.PIPE,
     )