Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_executable_missing_post_creation for Python 3.11, PyPy #459

Merged
merged 4 commits into from
Apr 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import inspect
import logging
import platform
import shutil
import subprocess
import sys
import sysconfig

import pytest

Expand Down Expand Up @@ -58,19 +56,12 @@ def test_can_get_venv_paths_with_conflicting_default_scheme(mocker):
assert get_scheme_names.call_count == 1


@pytest.mark.skipif(IS_PYPY3, reason='PyPy3 uses get path to create and provision venv')
def test_executable_missing_post_creation(mocker):
original_get_paths = sysconfig.get_paths

def _get_paths(*args, **kwargs): # noqa
shutil.rmtree(kwargs['vars']['base'])
return original_get_paths(*args, **kwargs)

get_paths = mocker.patch('sysconfig.get_paths', side_effect=_get_paths)
venv_create = mocker.patch('venv.EnvBuilder.create')
with pytest.raises(RuntimeError, match='Virtual environment creation failed, executable .* missing'):
with build.env.IsolatedEnvBuilder():
pass
assert get_paths.call_count == 1
assert venv_create.call_count == 1


def test_isolated_env_abstract():
Expand Down