def test_build_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.build(self.source_dir) self.assertEquals(err.exception.args[0], 'Maven Failed: Some Error Message')
def test_build_project(self): maven = SubprocessMaven(maven_binary=self.maven_binary, os_utils=self.os_utils) maven.build(self.source_dir) self.os_utils.popen.assert_called_with( [self.maven_path, "clean", "install"], cwd=self.source_dir, stderr=subprocess.PIPE, stdout=subprocess.PIPE)