File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -549,7 +549,7 @@ def _detect_active_python(self) -> str | None:
549
549
self ._io .write_error_line (
550
550
f"Found: { executable } " , verbosity = Verbosity .VERBOSE
551
551
)
552
- except CalledProcessError :
552
+ except EnvCommandError :
553
553
self ._io .write_error_line (
554
554
"Unable to detect the current active python executable. Falling back to"
555
555
" default." ,
Original file line number Diff line number Diff line change @@ -1601,3 +1601,15 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
1601
1601
},
1602
1602
prompt = "virtualenv-py3.7" ,
1603
1603
)
1604
+
1605
+
1606
+ def test_fallback_on_detect_active_python (poetry : Poetry , mocker : MockerFixture ):
1607
+ m = mocker .patch (
1608
+ "subprocess.check_output" ,
1609
+ side_effect = subprocess .CalledProcessError (1 , "some command" ),
1610
+ )
1611
+ env_manager = EnvManager (poetry )
1612
+ active_python = env_manager ._detect_active_python ()
1613
+
1614
+ assert active_python is None
1615
+ assert m .call_count == 1
You can’t perform that action at this time.
0 commit comments