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
6ae844bc
Commit
6ae844bc
authored
Sep 11, 2022
by
David Hotham
Committed by
Bjorn Neergaard
Sep 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
respect --no-cache at poetry install
parent
60168d68
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
2 deletions
+40
-2
src/poetry/console/application.py
+1
-0
src/poetry/factory.py
+1
-0
src/poetry/installation/executor.py
+4
-1
src/poetry/installation/installer.py
+4
-1
src/poetry/poetry.py
+6
-0
tests/console/test_application.py
+24
-0
No files found.
src/poetry/console/application.py
View file @
6ae844bc
...
@@ -327,6 +327,7 @@ class Application(BaseApplication): # type: ignore[misc]
...
@@ -327,6 +327,7 @@ class Application(BaseApplication): # type: ignore[misc]
poetry
.
locker
,
poetry
.
locker
,
poetry
.
pool
,
poetry
.
pool
,
poetry
.
config
,
poetry
.
config
,
disable_cache
=
poetry
.
disable_cache
,
)
)
installer
.
use_executor
(
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
))
installer
.
use_executor
(
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
))
command
.
set_installer
(
installer
)
command
.
set_installer
(
installer
)
...
...
src/poetry/factory.py
View file @
6ae844bc
...
@@ -92,6 +92,7 @@ class Factory(BaseFactory):
...
@@ -92,6 +92,7 @@ class Factory(BaseFactory):
base_poetry
.
package
,
base_poetry
.
package
,
locker
,
locker
,
config
,
config
,
disable_cache
,
)
)
# Configuring sources
# Configuring sources
...
...
src/poetry/installation/executor.py
View file @
6ae844bc
...
@@ -53,13 +53,16 @@ class Executor:
...
@@ -53,13 +53,16 @@ class Executor:
config
:
Config
,
config
:
Config
,
io
:
IO
,
io
:
IO
,
parallel
:
bool
|
None
=
None
,
parallel
:
bool
|
None
=
None
,
disable_cache
:
bool
=
False
,
)
->
None
:
)
->
None
:
self
.
_env
=
env
self
.
_env
=
env
self
.
_io
=
io
self
.
_io
=
io
self
.
_dry_run
=
False
self
.
_dry_run
=
False
self
.
_enabled
=
True
self
.
_enabled
=
True
self
.
_verbose
=
False
self
.
_verbose
=
False
self
.
_authenticator
=
Authenticator
(
config
,
self
.
_io
)
self
.
_authenticator
=
Authenticator
(
config
,
self
.
_io
,
disable_cache
=
disable_cache
)
self
.
_chef
=
Chef
(
config
,
self
.
_env
)
self
.
_chef
=
Chef
(
config
,
self
.
_env
)
self
.
_chooser
=
Chooser
(
pool
,
self
.
_env
,
config
)
self
.
_chooser
=
Chooser
(
pool
,
self
.
_env
,
config
)
...
...
src/poetry/installation/installer.py
View file @
6ae844bc
...
@@ -43,6 +43,7 @@ class Installer:
...
@@ -43,6 +43,7 @@ class Installer:
config
:
Config
,
config
:
Config
,
installed
:
Repository
|
None
=
None
,
installed
:
Repository
|
None
=
None
,
executor
:
Executor
|
None
=
None
,
executor
:
Executor
|
None
=
None
,
disable_cache
:
bool
=
False
,
)
->
None
:
)
->
None
:
self
.
_io
=
io
self
.
_io
=
io
self
.
_env
=
env
self
.
_env
=
env
...
@@ -65,7 +66,9 @@ class Installer:
...
@@ -65,7 +66,9 @@ class Installer:
self
.
_extras
:
list
[
str
]
=
[]
self
.
_extras
:
list
[
str
]
=
[]
if
executor
is
None
:
if
executor
is
None
:
executor
=
Executor
(
self
.
_env
,
self
.
_pool
,
config
,
self
.
_io
)
executor
=
Executor
(
self
.
_env
,
self
.
_pool
,
config
,
self
.
_io
,
disable_cache
=
disable_cache
)
self
.
_executor
=
executor
self
.
_executor
=
executor
self
.
_use_executor
=
False
self
.
_use_executor
=
False
...
...
src/poetry/poetry.py
View file @
6ae844bc
...
@@ -30,6 +30,7 @@ class Poetry(BasePoetry):
...
@@ -30,6 +30,7 @@ class Poetry(BasePoetry):
package
:
ProjectPackage
,
package
:
ProjectPackage
,
locker
:
Locker
,
locker
:
Locker
,
config
:
Config
,
config
:
Config
,
disable_cache
:
bool
=
False
,
)
->
None
:
)
->
None
:
from
poetry.repositories.pool
import
Pool
from
poetry.repositories.pool
import
Pool
...
@@ -39,6 +40,7 @@ class Poetry(BasePoetry):
...
@@ -39,6 +40,7 @@ class Poetry(BasePoetry):
self
.
_config
=
config
self
.
_config
=
config
self
.
_pool
=
Pool
()
self
.
_pool
=
Pool
()
self
.
_plugin_manager
:
PluginManager
|
None
=
None
self
.
_plugin_manager
:
PluginManager
|
None
=
None
self
.
_disable_cache
=
disable_cache
@property
@property
def
locker
(
self
)
->
Locker
:
def
locker
(
self
)
->
Locker
:
...
@@ -52,6 +54,10 @@ class Poetry(BasePoetry):
...
@@ -52,6 +54,10 @@ class Poetry(BasePoetry):
def
config
(
self
)
->
Config
:
def
config
(
self
)
->
Config
:
return
self
.
_config
return
self
.
_config
@property
def
disable_cache
(
self
)
->
bool
:
return
self
.
_disable_cache
def
set_locker
(
self
,
locker
:
Locker
)
->
Poetry
:
def
set_locker
(
self
,
locker
:
Locker
)
->
Poetry
:
self
.
_locker
=
locker
self
.
_locker
=
locker
...
...
tests/console/test_application.py
View file @
6ae844bc
...
@@ -11,6 +11,7 @@ from cleo.testers.application_tester import ApplicationTester
...
@@ -11,6 +11,7 @@ from cleo.testers.application_tester import ApplicationTester
from
poetry.console.application
import
Application
from
poetry.console.application
import
Application
from
poetry.console.commands.command
import
Command
from
poetry.console.commands.command
import
Command
from
poetry.plugins.application_plugin
import
ApplicationPlugin
from
poetry.plugins.application_plugin
import
ApplicationPlugin
from
poetry.utils.authenticator
import
Authenticator
from
tests.helpers
import
mock_metadata_entry_points
from
tests.helpers
import
mock_metadata_entry_points
...
@@ -99,3 +100,26 @@ def test_application_verify_source_cache_flag(disable_cache: bool):
...
@@ -99,3 +100,26 @@ def test_application_verify_source_cache_flag(disable_cache: bool):
for
repo
in
app
.
poetry
.
pool
.
repositories
:
for
repo
in
app
.
poetry
.
pool
.
repositories
:
assert
repo
.
_disable_cache
==
disable_cache
assert
repo
.
_disable_cache
==
disable_cache
@pytest.mark.parametrize
(
"disable_cache"
,
[
True
,
False
])
def
test_application_verify_cache_flag_at_install
(
mocker
:
MockerFixture
,
disable_cache
:
bool
)
->
None
:
app
=
Application
()
tester
=
ApplicationTester
(
app
)
command
=
"install --dry-run"
if
disable_cache
:
command
=
f
"{command} --no-cache"
spy
=
mocker
.
spy
(
Authenticator
,
"__init__"
)
tester
.
execute
(
command
)
assert
spy
.
call_count
==
2
for
call
in
spy
.
mock_calls
:
(
name
,
args
,
kwargs
)
=
call
assert
"disable_cache"
in
kwargs
assert
disable_cache
is
kwargs
[
"disable_cache"
]
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