def test_build_python_wheel_fail(self, m1, m2): conf = {**takeoff_config(), **BASE_CONF} with pytest.raises(ChildProcessError): with mock.patch("takeoff.build_artifact.run_shell_command", return_value=(1, ['output_lines'])) as m: victim(FAKE_ENV, conf).build_sbt_assembly_jar() m.assert_called_once_with(["sbt", "clean", "assembly"])
def test_write_version(self): mopen = mock.mock_open() conf = {**takeoff_config(), **BASE_CONF} with mock.patch("builtins.open", mopen): victim(FAKE_ENV, conf)._write_version() mopen.assert_called_once_with("version.py", "w+") handle = mopen() handle.write.assert_called_once_with("__version__='v'")
def test_build_python_wheel(self, m1, m2): conf = {**takeoff_config(), **BASE_CONF} with mock.patch("takeoff.build_artifact.run_shell_command", return_value=(0, ['output_lines'])) as m: victim(FAKE_ENV, conf).build_python_wheel() m.assert_called_once_with(["python", "setup.py", "bdist_wheel"])
def test_build_sbt(self): conf = {**takeoff_config(), **BASE_CONF, "build_tool": "sbt"} with mock.patch.object(victim, "build_sbt_assembly_jar") as m: victim(FAKE_ENV, conf).run() m.assert_called_once()
def test_build_python(self): conf = {**takeoff_config(), **BASE_CONF} with mock.patch.object(victim, "build_python_wheel") as m: victim(FAKE_ENV, conf).run() m.assert_called_once()
def test_validate_minimal_schema(self): conf = {**takeoff_config(), **BASE_CONF} victim(FAKE_ENV, conf)