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
a8968842
Unverified
Commit
a8968842
authored
Aug 15, 2022
by
Bartosz Sokorski
Committed by
GitHub
Aug 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover edge case when environment is being created with empty project name (#5856)
parent
7bb0a876
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
1 deletions
+62
-1
src/poetry/utils/env.py
+2
-1
tests/fixtures/no_name_project/README.rst
+2
-0
tests/fixtures/no_name_project/pyproject.toml
+18
-0
tests/utils/test_env.py
+40
-0
No files found.
src/poetry/utils/env.py
View file @
a8968842
...
@@ -948,7 +948,8 @@ class EnvManager:
...
@@ -948,7 +948,8 @@ class EnvManager:
if
venv_prompt
is
not
None
:
if
venv_prompt
is
not
None
:
venv_prompt
=
venv_prompt
.
format
(
venv_prompt
=
venv_prompt
.
format
(
project_name
=
self
.
_poetry
.
package
.
name
,
python_version
=
python_minor
project_name
=
self
.
_poetry
.
package
.
name
or
"virtualenv"
,
python_version
=
python_minor
,
)
)
if
not
venv
.
exists
():
if
not
venv
.
exists
():
...
...
tests/fixtures/no_name_project/README.rst
0 → 100644
View file @
a8968842
No name project
===============
tests/fixtures/no_name_project/pyproject.toml
0 → 100644
View file @
a8968842
[tool.poetry]
name
=
""
version
=
"1.2.3"
description
=
"This project has no name"
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
readme
=
"README.rst"
# Requirements
[tool.poetry.dependencies]
python
=
"~2.7 || ^3.6"
[tool.poetry.group.dev.dependencies]
pytest
=
"~3.4"
tests/utils/test_env.py
View file @
a8968842
...
@@ -1415,3 +1415,43 @@ def test_build_environment_not_called_without_build_script_specified(
...
@@ -1415,3 +1415,43 @@ def test_build_environment_not_called_without_build_script_specified(
with
build_environment
(
poetry
,
project_env
)
as
env
:
with
build_environment
(
poetry
,
project_env
)
as
env
:
assert
env
==
project_env
assert
env
==
project_env
assert
not
env
.
executed
assert
not
env
.
executed
def
test_create_venv_project_name_empty_sets_correct_prompt
(
project_factory
:
ProjectFactory
,
config
:
Config
,
mocker
:
MockerFixture
,
config_virtualenvs_path
:
Path
,
):
if
"VIRTUAL_ENV"
in
os
.
environ
:
del
os
.
environ
[
"VIRTUAL_ENV"
]
fixture
=
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"no_name_project"
poetry
=
project_factory
(
"no"
,
source
=
fixture
)
manager
=
EnvManager
(
poetry
)
poetry
.
package
.
python_versions
=
"^3.7"
venv_name
=
manager
.
generate_env_name
(
""
,
str
(
poetry
.
file
.
parent
))
mocker
.
patch
(
"sys.version_info"
,
(
2
,
7
,
16
))
mocker
.
patch
(
"subprocess.check_output"
,
side_effect
=
check_output_wrapper
(
Version
.
parse
(
"3.7.5"
)),
)
m
=
mocker
.
patch
(
"poetry.utils.env.EnvManager.build_venv"
,
side_effect
=
lambda
*
args
,
**
kwargs
:
""
)
manager
.
create_venv
(
NullIO
())
m
.
assert_called_with
(
config_virtualenvs_path
/
f
"{venv_name}-py3.7"
,
executable
=
"python3"
,
flags
=
{
"always-copy"
:
False
,
"system-site-packages"
:
False
,
"no-pip"
:
False
,
"no-setuptools"
:
False
,
},
prompt
=
"virtualenv-py3.7"
,
)
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