def test__pip_build_called_process_error(tmp_path): patch_cmd = patch.object( PythonLanguagePlugin, "_make_pip_command", return_value=["false"] ) with patch_cmd as mock_cmd: with pytest.raises(DownstreamError) as excinfo: PythonLanguagePlugin._pip_build(tmp_path) mock_cmd.assert_called_once_with(tmp_path) assert isinstance(excinfo.value.__cause__, CalledProcessError)
def test__pip_build_executable_not_found(tmp_path): executable_name = str(uuid4()) patch_cmd = patch.object( PythonLanguagePlugin, "_make_pip_command", return_value=[executable_name] ) with patch_cmd as mock_cmd: with pytest.raises(DownstreamError) as excinfo: PythonLanguagePlugin._pip_build(tmp_path) mock_cmd.assert_called_once_with(tmp_path) assert isinstance(excinfo.value.__cause__, FileNotFoundError)
def test__remove_build_artifacts_file_not_found(tmp_path): deps_path = tmp_path / "build" with patch("rpdk.python.codegen.LOG", autospec=True) as mock_log: PythonLanguagePlugin._remove_build_artifacts(deps_path) mock_log.debug.assert_called_once()
def test__remove_build_artifacts_file_found(tmp_path): deps_path = tmp_path / "build" deps_path.mkdir() PythonLanguagePlugin._remove_build_artifacts(deps_path)
def test__check_for_support_lib_sdist(tmp_path): with pytest.raises(StandardDistNotFoundError): PythonLanguagePlugin._check_for_support_lib_sdist(tmp_path)