def test_copy_dependency_raises_exception_if_retcode_not_0(self): self.popen = FakePopen(retcode=1, out=b'Some Error Message') self.os_utils.popen.side_effect = [self.popen] maven = SubprocessMaven(maven_binary=self.maven_binary, os_utils=self.os_utils) with self.assertRaises(MavenExecutionError) as err: maven.copy_dependency(self.source_dir) self.assertEquals(err.exception.args[0], 'Maven Failed: Some Error Message')
def test_copy_dependency(self): maven = SubprocessMaven(maven_binary=self.maven_binary, os_utils=self.os_utils) maven.copy_dependency(self.source_dir) self.os_utils.popen.assert_called_with( [self.maven_path, "dependency:copy-dependencies", "-DincludeScope=compile"], cwd=self.source_dir, stderr=subprocess.PIPE, stdout=subprocess.PIPE, )