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
be8cd1fb
Commit
be8cd1fb
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): get full python path for appropriate executable
parent
fa29e769
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
src/poetry/utils/env.py
+1
-1
tests/utils/test_env.py
+18
-8
No files found.
src/poetry/utils/env.py
View file @
be8cd1fb
...
@@ -995,7 +995,7 @@ class EnvManager:
...
@@ -995,7 +995,7 @@ class EnvManager:
self
.
_io
.
write_error_line
(
self
.
_io
.
write_error_line
(
f
"Using <c1>{python}</c1> ({python_patch})"
f
"Using <c1>{python}</c1> ({python_patch})"
)
)
executable
=
python
executable
=
self
.
_full_python_path
(
python
)
python_minor
=
"."
.
join
(
python_patch
.
split
(
"."
)[:
2
])
python_minor
=
"."
.
join
(
python_patch
.
split
(
"."
)[:
2
])
break
break
...
...
tests/utils/test_env.py
View file @
be8cd1fb
...
@@ -18,6 +18,7 @@ from poetry.factory import Factory
...
@@ -18,6 +18,7 @@ from poetry.factory import Factory
from
poetry.repositories.installed_repository
import
InstalledRepository
from
poetry.repositories.installed_repository
import
InstalledRepository
from
poetry.utils._compat
import
WINDOWS
from
poetry.utils._compat
import
WINDOWS
from
poetry.utils.env
import
GET_BASE_PREFIX
from
poetry.utils.env
import
GET_BASE_PREFIX
from
poetry.utils.env
import
GET_PYTHON_VERSION_ONELINER
from
poetry.utils.env
import
EnvCommandError
from
poetry.utils.env
import
EnvCommandError
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
GenericEnv
from
poetry.utils.env
import
GenericEnv
...
@@ -1002,7 +1003,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_
...
@@ -1002,7 +1003,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_
m
.
assert_called_with
(
m
.
assert_called_with
(
config_virtualenvs_path
/
f
"{venv_name}-py3.7"
,
config_virtualenvs_path
/
f
"{venv_name}-py3.7"
,
executable
=
"python3"
,
executable
=
"
/usr/bin/
python3"
,
flags
=
{
flags
=
{
"always-copy"
:
False
,
"always-copy"
:
False
,
"system-site-packages"
:
False
,
"system-site-packages"
:
False
,
...
@@ -1027,7 +1028,9 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific
...
@@ -1027,7 +1028,9 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific
poetry
.
package
.
python_versions
=
"^3.6"
poetry
.
package
.
python_versions
=
"^3.6"
mocker
.
patch
(
"sys.version_info"
,
(
2
,
7
,
16
))
mocker
.
patch
(
"sys.version_info"
,
(
2
,
7
,
16
))
mocker
.
patch
(
"subprocess.check_output"
,
side_effect
=
[
"3.5.3"
,
"3.9.0"
])
mocker
.
patch
(
"subprocess.check_output"
,
side_effect
=
[
"3.5.3"
,
"3.9.0"
,
"/usr/bin/python3.9"
]
)
m
=
mocker
.
patch
(
m
=
mocker
.
patch
(
"poetry.utils.env.EnvManager.build_venv"
,
side_effect
=
lambda
*
args
,
**
kwargs
:
""
"poetry.utils.env.EnvManager.build_venv"
,
side_effect
=
lambda
*
args
,
**
kwargs
:
""
)
)
...
@@ -1036,7 +1039,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific
...
@@ -1036,7 +1039,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific
m
.
assert_called_with
(
m
.
assert_called_with
(
config_virtualenvs_path
/
f
"{venv_name}-py3.9"
,
config_virtualenvs_path
/
f
"{venv_name}-py3.9"
,
executable
=
"python3.9"
,
executable
=
"
/usr/bin/
python3.9"
,
flags
=
{
flags
=
{
"always-copy"
:
False
,
"always-copy"
:
False
,
"system-site-packages"
:
False
,
"system-site-packages"
:
False
,
...
@@ -1459,11 +1462,18 @@ def test_create_venv_accepts_fallback_version_w_nonzero_patchlevel(
...
@@ -1459,11 +1462,18 @@ def test_create_venv_accepts_fallback_version_w_nonzero_patchlevel(
poetry
.
package
.
python_versions
=
"~3.5.1"
poetry
.
package
.
python_versions
=
"~3.5.1"
def
mock_check_output
(
cmd
:
str
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
str
:
if
GET_PYTHON_VERSION_ONELINER
in
cmd
:
if
"python3.5"
in
cmd
:
return
"3.5.12"
else
:
return
"3.7.1"
else
:
return
"/usr/bin/python3.5"
check_output
=
mocker
.
patch
(
check_output
=
mocker
.
patch
(
"subprocess.check_output"
,
"subprocess.check_output"
,
side_effect
=
lambda
cmd
,
*
args
,
**
kwargs
:
str
(
side_effect
=
mock_check_output
,
"3.5.12"
if
"python3.5"
in
cmd
else
"3.7.1"
),
)
)
m
=
mocker
.
patch
(
m
=
mocker
.
patch
(
"poetry.utils.env.EnvManager.build_venv"
,
side_effect
=
lambda
*
args
,
**
kwargs
:
""
"poetry.utils.env.EnvManager.build_venv"
,
side_effect
=
lambda
*
args
,
**
kwargs
:
""
...
@@ -1474,7 +1484,7 @@ def test_create_venv_accepts_fallback_version_w_nonzero_patchlevel(
...
@@ -1474,7 +1484,7 @@ def test_create_venv_accepts_fallback_version_w_nonzero_patchlevel(
assert
check_output
.
called
assert
check_output
.
called
m
.
assert_called_with
(
m
.
assert_called_with
(
config_virtualenvs_path
/
f
"{venv_name}-py3.5"
,
config_virtualenvs_path
/
f
"{venv_name}-py3.5"
,
executable
=
"python3.5"
,
executable
=
"
/usr/bin/
python3.5"
,
flags
=
{
flags
=
{
"always-copy"
:
False
,
"always-copy"
:
False
,
"system-site-packages"
:
False
,
"system-site-packages"
:
False
,
...
@@ -1582,7 +1592,7 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
...
@@ -1582,7 +1592,7 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
m
.
assert_called_with
(
m
.
assert_called_with
(
config_virtualenvs_path
/
f
"{venv_name}-py3.7"
,
config_virtualenvs_path
/
f
"{venv_name}-py3.7"
,
executable
=
"python3"
,
executable
=
"
/usr/bin/
python3"
,
flags
=
{
flags
=
{
"always-copy"
:
False
,
"always-copy"
:
False
,
"system-site-packages"
:
False
,
"system-site-packages"
:
False
,
...
...
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