Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
ed5441f5
Commit
ed5441f5
authored
Dec 19, 2022
by
finswimmer
Committed by
Randy Döring
Jan 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(env): catch EnvCommandError instead of CalledProcessError when detecting active python
parent
be8cd1fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
src/poetry/utils/env.py
+1
-1
tests/utils/test_env.py
+12
-0
No files found.
src/poetry/utils/env.py
View file @
ed5441f5
...
@@ -551,7 +551,7 @@ class EnvManager:
...
@@ -551,7 +551,7 @@ class EnvManager:
self
.
_io
.
write_error_line
(
self
.
_io
.
write_error_line
(
f
"Found: {executable}"
,
verbosity
=
Verbosity
.
VERBOSE
f
"Found: {executable}"
,
verbosity
=
Verbosity
.
VERBOSE
)
)
except
CalledProcess
Error
:
except
EnvCommand
Error
:
self
.
_io
.
write_error_line
(
self
.
_io
.
write_error_line
(
(
(
"Unable to detect the current active python executable. Falling"
"Unable to detect the current active python executable. Falling"
...
...
tests/utils/test_env.py
View file @
ed5441f5
...
@@ -1601,3 +1601,15 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
...
@@ -1601,3 +1601,15 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
},
},
prompt
=
"virtualenv-py3.7"
,
prompt
=
"virtualenv-py3.7"
,
)
)
def
test_fallback_on_detect_active_python
(
poetry
:
Poetry
,
mocker
:
MockerFixture
):
m
=
mocker
.
patch
(
"subprocess.check_output"
,
side_effect
=
subprocess
.
CalledProcessError
(
1
,
"some command"
),
)
env_manager
=
EnvManager
(
poetry
)
active_python
=
env_manager
.
_detect_active_python
()
assert
active_python
is
None
assert
m
.
call_count
==
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment