@@ -51,21 +51,32 @@ def test_isolated_environment_install(mocker):
5151 ]
5252
5353
54+ @pytest .mark .skipif (IS_PY2 , reason = 'venv module used on Python 3 only' )
55+ @pytest .mark .skipif (IS_PYPY3 , reason = 'PyPy3 uses get path to create and provision venv' )
56+ @pytest .mark .skipif (sys .platform != 'darwin' , reason = 'workaround for Apple Python' )
57+ def test_can_get_venv_paths_with_conflicting_default_scheme (mocker ):
58+ mocker .patch .object (build .env , 'virtualenv' , None )
59+ get_scheme_names = mocker .patch ('sysconfig.get_scheme_names' , return_value = ('osx_framework_library' ,))
60+ with build .env .IsolatedEnvBuilder ():
61+ pass
62+ assert get_scheme_names .call_count == 1
63+
64+
5465@pytest .mark .skipif (IS_PY2 , reason = 'venv module used on Python 3 only' )
5566@pytest .mark .skipif (IS_PYPY3 , reason = 'PyPy3 uses get path to create and provision venv' )
5667def test_executable_missing_post_creation (mocker ):
5768 mocker .patch .object (build .env , 'virtualenv' , None )
58- original_get_path = sysconfig .get_path
69+ original_get_paths = sysconfig .get_paths
5970
60- def _get_path ( name , vars ): # noqa
71+ def _get_paths ( vars ): # noqa
6172 shutil .rmtree (vars ['base' ])
62- return original_get_path ( name , vars = vars )
73+ return original_get_paths ( vars = vars )
6374
64- get_path = mocker .patch ('sysconfig.get_path ' , side_effect = _get_path )
75+ get_paths = mocker .patch ('sysconfig.get_paths ' , side_effect = _get_paths )
6576 with pytest .raises (RuntimeError , match = 'Virtual environment creation failed, executable .* missing' ):
6677 with build .env .IsolatedEnvBuilder ():
6778 pass
68- assert get_path .call_count == 1
79+ assert get_paths .call_count == 1
6980
7081
7182def test_isolated_env_abstract ():
0 commit comments