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
d4c2fe44
Commit
d4c2fe44
authored
Mar 19, 2021
by
Ashley Whetter
Committed by
Bjorn Neergaard
Nov 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
POETRY_EXPERIMENTAL_NEW_INSTALLER is interpreted as a boolean
parent
56f81631
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
src/poetry/config/config.py
+1
-0
tests/config/test_config.py
+27
-9
No files found.
src/poetry/config/config.py
View file @
d4c2fe44
...
...
@@ -132,6 +132,7 @@ class Config:
"virtualenvs.in-project"
,
"virtualenvs.options.always-copy"
,
"virtualenvs.options.system-site-packages"
,
"experimental.new-installer"
,
"installer.parallel"
,
}:
return
boolean_normalizer
...
...
tests/config/test_config.py
View file @
d4c2fe44
import
os
import
re
import
pytest
from
poetry.config.config
import
Config
def
get_boolean_options
(
config
=
None
):
if
config
is
None
:
config
=
Config
.
default_config
for
k
,
v
in
config
.
items
():
if
isinstance
(
v
,
bool
)
or
v
is
None
:
yield
k
if
isinstance
(
v
,
dict
):
for
suboption
in
get_boolean_options
(
v
):
yield
"{}.{}"
.
format
(
k
,
suboption
)
@pytest.mark.parametrize
(
(
"name"
,
"value"
),
[(
"installer.parallel"
,
True
),
(
"virtualenvs.create"
,
True
)]
...
...
@@ -14,16 +29,19 @@ def test_config_get_processes_depended_on_values(config, config_cache_dir):
assert
str
(
config_cache_dir
/
"virtualenvs"
)
==
config
.
get
(
"virtualenvs.path"
)
def
generate_environment_variable_tests
():
for
env_value
,
value
in
[(
"true"
,
True
),
(
"false"
,
False
)]:
for
name
in
get_boolean_options
():
env_var
=
"POETRY_{}"
.
format
(
re
.
sub
(
"[.-]+"
,
"_"
,
name
)
.
upper
())
yield
(
name
,
env_var
,
env_value
,
value
)
@pytest.mark.parametrize
(
(
"name"
,
"env_value"
,
"value"
),
[
(
"installer.parallel"
,
"true"
,
True
),
(
"installer.parallel"
,
"false"
,
False
),
(
"virtualenvs.create"
,
"true"
,
True
),
(
"virtualenvs.create"
,
"false"
,
False
),
],
(
"name"
,
"env_var"
,
"env_value"
,
"value"
),
list
(
generate_environment_variable_tests
()),
)
def
test_config_get_from_environment_variable
(
config
,
environ
,
name
,
env_value
,
value
):
env_var
=
"POETRY_{}"
.
format
(
"_"
.
join
(
k
.
upper
()
for
k
in
name
.
split
(
"."
)))
def
test_config_get_from_environment_variable
(
config
,
environ
,
name
,
env_var
,
env_value
,
value
):
os
.
environ
[
env_var
]
=
env_value
assert
config
.
get
(
name
)
is
value
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