def test_install_pipenv_deploy_error_python(venv): """Test installation error on --deploy set, error because Python version.""" with cwd(os.path.join(_DATA_DIR, "install", "pipenv_error_python")): flexmock(micropipenv).should_receive("_maybe_print_pipfile_lock").once() err_msg = r"Running Python version \d.\d, but Pipfile.lock requires Python version 5.9" with pytest.raises(micropipenv.PythonVersionMismatch, match=err_msg): micropipenv.install_pipenv(get_pip_path(venv), deploy=True)
def test_install_pipenv_deploy_error_hash(venv): """Test installation error on --deploy set, error because wrong hash in Pipfile.lock.""" with cwd(os.path.join(_DATA_DIR, "install", "pipenv_error_hash")): flexmock(micropipenv).should_receive( "_maybe_print_pipfile_lock").once() err_msg = ( "Pipfile.lock hash 'foobar' does not correspond to hash computed based " "on Pipfile '8b8dfe383cda8e22d95623518c911b7d5cf28acb8fccd4b7d8dc67fce444b6d3', " "aborting deployment") with pytest.raises(micropipenv.HashMismatch, match=err_msg): micropipenv.install_pipenv(get_pip_path(venv), deploy=True)
def test_install_pipenv_iter_index(venv): """Test triggering multiple installations if index is not explicitly set to one.""" with cwd(os.path.join(_DATA_DIR, "install", "pipenv_iter_index")): micropipenv.install_pipenv(get_pip_path(venv), deploy=False) assert str(venv.get_version("requests")) == "1.0.0"