Skip to content

Commit

Permalink
Test that the posix_local scheme is avoided, correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanor committed Apr 21, 2022
1 parent c6218ec commit b24f11f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_env.py
Expand Up @@ -4,6 +4,7 @@
import logging
import platform
import subprocess
import sysconfig
import sys

import pytest
Expand Down Expand Up @@ -56,6 +57,17 @@ def test_can_get_venv_paths_with_conflicting_default_scheme(mocker):
assert get_scheme_names.call_count == 1


@pytest.mark.skipif('posix_local' not in sysconfig.get_scheme_names(), reason='workaround for Debian/Ubuntu Python')
def test_can_get_venv_paths_with_posix_local_default_scheme(mocker):
get_paths = mocker.spy(sysconfig, 'get_paths')
# We should never call this, but we patch it to ensure failure if we do
get_default_scheme = mocker.patch('sysconfig.get_default_scheme', return_value='posix_local')
with build.env.IsolatedEnvBuilder():
pass
get_paths.assert_called_once_with(scheme='posix_prefix', vars=mocker.ANY)
assert get_default_scheme.call_count == 0


def test_executable_missing_post_creation(mocker):
venv_create = mocker.patch('venv.EnvBuilder.create')
with pytest.raises(RuntimeError, match='Virtual environment creation failed, executable .* missing'):
Expand Down

0 comments on commit b24f11f

Please sign in to comment.