File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
test/integration/tools/system Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ def generate(self):
2424 env .prepend_path ("PATH" , self .bin_dir )
2525 env .vars (self ._conanfile ).save_script (self .env_name )
2626
27- def _create_venv (self ):
27+ @staticmethod
28+ def _default_python ():
2829 default_python = shutil .which ('python' ) if platform .system () == "Windows" else shutil .which ('python3' )
29- python_interpreter = self ._conanfile .conf .get ("tools.system.pipenv:python_interpreter" ,
30- default = os .path .realpath (default_python ) if default_python else None )
30+ return os .path .realpath (default_python ) if default_python else None
31+
32+ def _create_venv (self ):
33+ python_interpreter = self ._conanfile .conf .get ("tools.system.pipenv:python_interpreter" ) or self ._default_python ()
3134 if not python_interpreter :
3235 raise ConanException ("PipEnv could not find a Python executable path."
3336 "Please set 'tools.system.pipenv:python_interpreter' to '</your/python/full/path>' "
Original file line number Diff line number Diff line change 88from conan .test .utils .mocks import ConanFileMock
99
1010
11- def test_pipenv_conf ():
11+ @patch ('shutil.which' )
12+ def test_pipenv_conf (mock_shutil_which ):
1213 # https://github.com/conan-io/conan/issues/11661
1314 conanfile = ConanFileMock ()
1415 conanfile .settings = Settings ()
16+ mock_shutil_which .side_effect = Exception ()
1517 conanfile .conf .define ("tools.system.pipenv:python_interpreter" , "/python/interpreter/from/config" )
1618 result = "/python/interpreter/from/config -m venv"
1719 pipenv = PipEnv (conanfile , "testenv" )
You can’t perform that action at this time.
0 commit comments