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
e1b45f85
Commit
e1b45f85
authored
Nov 27, 2021
by
Arun Babu Neelicattu
Committed by
Bjorn Neergaard
Nov 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint: fix semantic bugs in codebase
parent
19c472aa
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
41 deletions
+23
-41
src/poetry/mixology/incompatibility.py
+4
-10
src/poetry/utils/env.py
+0
-2
tests/console/commands/plugin/test_remove.py
+3
-3
tests/installation/test_executor.py
+16
-22
tests/installation/test_installer.py
+0
-1
tests/installation/test_installer_old.py
+0
-1
tests/puzzle/test_solver.py
+0
-2
No files found.
src/poetry/mixology/incompatibility.py
View file @
e1b45f85
...
@@ -176,16 +176,10 @@ class Incompatibility:
...
@@ -176,16 +176,10 @@ class Incompatibility:
if
len
(
self
.
_terms
)
==
1
:
if
len
(
self
.
_terms
)
==
1
:
term
=
self
.
_terms
[
0
]
term
=
self
.
_terms
[
0
]
if
term
.
constraint
.
is_any
():
return
"{} is {}"
.
format
(
return
"{} is {}"
.
format
(
term
.
dependency
.
name
,
term
.
dependency
.
name
,
"forbidden"
if
term
.
is_positive
()
else
"required"
,
"forbidden"
if
term
.
is_positive
()
else
"required"
,
)
)
else
:
return
"{} is {}"
.
format
(
term
.
dependency
.
name
,
"forbidden"
if
term
.
is_positive
()
else
"required"
,
)
if
len
(
self
.
_terms
)
==
2
:
if
len
(
self
.
_terms
)
==
2
:
term1
=
self
.
_terms
[
0
]
term1
=
self
.
_terms
[
0
]
...
...
src/poetry/utils/env.py
View file @
e1b45f85
...
@@ -1719,8 +1719,6 @@ class GenericEnv(VirtualEnv):
...
@@ -1719,8 +1719,6 @@ class GenericEnv(VirtualEnv):
if
pip_executable
.
endswith
(
".exe"
):
if
pip_executable
.
endswith
(
".exe"
):
pip_executable
=
pip_executable
[:
-
4
]
pip_executable
=
pip_executable
[:
-
4
]
pip_executable
=
pip_executable
if
python_executable
:
if
python_executable
:
self
.
_executable
=
python_executable
self
.
_executable
=
python_executable
...
...
tests/console/commands/plugin/test_remove.py
View file @
e1b45f85
...
@@ -68,16 +68,16 @@ def install_plugin(env: "MockEnv", installed: "Repository", pyproject: None) ->
...
@@ -68,16 +68,16 @@ def install_plugin(env: "MockEnv", installed: "Repository", pyproject: None) ->
tomlkit
.
dumps
(
lock_content
),
encoding
=
"utf-8"
tomlkit
.
dumps
(
lock_content
),
encoding
=
"utf-8"
)
)
pyproject
=
tomlkit
.
loads
(
pyproject
_toml
=
tomlkit
.
loads
(
env
.
path
.
joinpath
(
"pyproject.toml"
)
.
read_text
(
encoding
=
"utf-8"
)
env
.
path
.
joinpath
(
"pyproject.toml"
)
.
read_text
(
encoding
=
"utf-8"
)
)
)
content
=
pyproject
[
"tool"
][
"poetry"
]
content
=
pyproject
_toml
[
"tool"
][
"poetry"
]
dependency_section
=
content
[
"dependencies"
]
dependency_section
=
content
[
"dependencies"
]
dependency_section
[
"poetry-plugin"
]
=
"^1.2.3"
dependency_section
[
"poetry-plugin"
]
=
"^1.2.3"
env
.
path
.
joinpath
(
"pyproject.toml"
)
.
write_text
(
env
.
path
.
joinpath
(
"pyproject.toml"
)
.
write_text
(
tomlkit
.
dumps
(
pyproject
),
encoding
=
"utf-8"
tomlkit
.
dumps
(
pyproject
_toml
),
encoding
=
"utf-8"
)
)
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
...
...
tests/installation/test_executor.py
View file @
e1b45f85
...
@@ -19,7 +19,6 @@ from poetry.core.packages.package import Package
...
@@ -19,7 +19,6 @@ from poetry.core.packages.package import Package
from
poetry.core.packages.utils.link
import
Link
from
poetry.core.packages.utils.link
import
Link
from
poetry.core.utils._compat
import
PY36
from
poetry.core.utils._compat
import
PY36
from
poetry.config.config
import
Config
from
poetry.installation.executor
import
Executor
from
poetry.installation.executor
import
Executor
from
poetry.installation.operations
import
Install
from
poetry.installation.operations
import
Install
from
poetry.installation.operations
import
Uninstall
from
poetry.installation.operations
import
Uninstall
...
@@ -35,6 +34,7 @@ if TYPE_CHECKING:
...
@@ -35,6 +34,7 @@ if TYPE_CHECKING:
from
httpretty.core
import
HTTPrettyRequest
from
httpretty.core
import
HTTPrettyRequest
from
pytest_mock
import
MockerFixture
from
pytest_mock
import
MockerFixture
from
poetry.config.config
import
Config
from
poetry.utils.env
import
VirtualEnv
from
poetry.utils.env
import
VirtualEnv
from
tests.types
import
FixtureDirGetter
from
tests.types
import
FixtureDirGetter
...
@@ -103,7 +103,7 @@ def mock_file_downloads(http: Type["httpretty.httpretty"]) -> None:
...
@@ -103,7 +103,7 @@ def mock_file_downloads(http: Type["httpretty.httpretty"]) -> None:
def
test_execute_executes_a_batch_of_operations
(
def
test_execute_executes_a_batch_of_operations
(
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
config
:
Config
,
config
:
"Config"
,
pool
:
Pool
,
pool
:
Pool
,
io
:
BufferedIO
,
io
:
BufferedIO
,
tmp_dir
:
str
,
tmp_dir
:
str
,
...
@@ -114,7 +114,6 @@ def test_execute_executes_a_batch_of_operations(
...
@@ -114,7 +114,6 @@ def test_execute_executes_a_batch_of_operations(
"poetry.installation.executor.pip_editable_install"
,
unsafe
=
not
PY36
"poetry.installation.executor.pip_editable_install"
,
unsafe
=
not
PY36
)
)
config
=
Config
()
config
.
merge
({
"cache-dir"
:
tmp_dir
})
config
.
merge
({
"cache-dir"
:
tmp_dir
})
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
...
@@ -184,9 +183,8 @@ Package operations: 4 installs, 1 update, 1 removal
...
@@ -184,9 +183,8 @@ Package operations: 4 installs, 1 update, 1 removal
def
test_execute_shows_skipped_operations_if_verbose
(
def
test_execute_shows_skipped_operations_if_verbose
(
config
:
Config
,
pool
:
Pool
,
io
:
BufferedIO
,
config_cache_dir
:
Path
,
env
:
MockEnv
config
:
"Config"
,
pool
:
Pool
,
io
:
BufferedIO
,
config_cache_dir
:
Path
,
env
:
MockEnv
):
):
config
=
Config
()
config
.
merge
({
"cache-dir"
:
config_cache_dir
.
as_posix
()})
config
.
merge
({
"cache-dir"
:
config_cache_dir
.
as_posix
()})
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
...
@@ -209,7 +207,7 @@ Package operations: 0 installs, 0 updates, 0 removals, 1 skipped
...
@@ -209,7 +207,7 @@ Package operations: 0 installs, 0 updates, 0 removals, 1 skipped
def
test_execute_should_show_errors
(
def
test_execute_should_show_errors
(
config
:
Config
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
config
:
"Config"
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
):
):
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
.
verbose
()
executor
.
verbose
()
...
@@ -233,14 +231,13 @@ Package operations: 1 install, 0 updates, 0 removals
...
@@ -233,14 +231,13 @@ Package operations: 1 install, 0 updates, 0 removals
def
test_execute_works_with_ansi_output
(
def
test_execute_works_with_ansi_output
(
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
config
:
Config
,
config
:
"Config"
,
pool
:
Pool
,
pool
:
Pool
,
io_decorated
:
BufferedIO
,
io_decorated
:
BufferedIO
,
tmp_dir
:
str
,
tmp_dir
:
str
,
mock_file_downloads
:
None
,
mock_file_downloads
:
None
,
env
:
MockEnv
,
env
:
MockEnv
,
):
):
config
=
Config
()
config
.
merge
({
"cache-dir"
:
tmp_dir
})
config
.
merge
({
"cache-dir"
:
tmp_dir
})
executor
=
Executor
(
env
,
pool
,
config
,
io_decorated
)
executor
=
Executor
(
env
,
pool
,
config
,
io_decorated
)
...
@@ -273,14 +270,13 @@ def test_execute_works_with_ansi_output(
...
@@ -273,14 +270,13 @@ def test_execute_works_with_ansi_output(
def
test_execute_works_with_no_ansi_output
(
def
test_execute_works_with_no_ansi_output
(
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
config
:
Config
,
config
:
"Config"
,
pool
:
Pool
,
pool
:
Pool
,
io_not_decorated
:
BufferedIO
,
io_not_decorated
:
BufferedIO
,
tmp_dir
:
str
,
tmp_dir
:
str
,
mock_file_downloads
:
None
,
mock_file_downloads
:
None
,
env
:
MockEnv
,
env
:
MockEnv
,
):
):
config
=
Config
()
config
.
merge
({
"cache-dir"
:
tmp_dir
})
config
.
merge
({
"cache-dir"
:
tmp_dir
})
executor
=
Executor
(
env
,
pool
,
config
,
io_not_decorated
)
executor
=
Executor
(
env
,
pool
,
config
,
io_not_decorated
)
...
@@ -308,7 +304,7 @@ Package operations: 1 install, 0 updates, 0 removals
...
@@ -308,7 +304,7 @@ Package operations: 1 install, 0 updates, 0 removals
def
test_execute_should_show_operation_as_cancelled_on_subprocess_keyboard_interrupt
(
def
test_execute_should_show_operation_as_cancelled_on_subprocess_keyboard_interrupt
(
config
:
Config
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
config
:
"Config"
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
):
):
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
.
verbose
()
executor
.
verbose
()
...
@@ -329,7 +325,7 @@ Package operations: 1 install, 0 updates, 0 removals
...
@@ -329,7 +325,7 @@ Package operations: 1 install, 0 updates, 0 removals
def
test_execute_should_gracefully_handle_io_error
(
def
test_execute_should_gracefully_handle_io_error
(
config
:
Config
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
config
:
"Config"
,
pool
:
Pool
,
mocker
:
"MockerFixture"
,
io
:
BufferedIO
,
env
:
MockEnv
):
):
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
.
verbose
()
executor
.
verbose
()
...
@@ -356,7 +352,7 @@ Package operations: 1 install, 0 updates, 0 removals
...
@@ -356,7 +352,7 @@ Package operations: 1 install, 0 updates, 0 removals
def
test_executor_should_delete_incomplete_downloads
(
def
test_executor_should_delete_incomplete_downloads
(
config
:
Config
,
config
:
"Config"
,
io
:
BufferedIO
,
io
:
BufferedIO
,
tmp_dir
:
str
,
tmp_dir
:
str
,
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
...
@@ -382,7 +378,6 @@ def test_executor_should_delete_incomplete_downloads(
...
@@ -382,7 +378,6 @@ def test_executor_should_delete_incomplete_downloads(
return_value
=
Path
(
tmp_dir
),
return_value
=
Path
(
tmp_dir
),
)
)
config
=
Config
()
config
.
merge
({
"cache-dir"
:
tmp_dir
})
config
.
merge
({
"cache-dir"
:
tmp_dir
})
executor
=
Executor
(
env
,
pool
,
config
,
io
)
executor
=
Executor
(
env
,
pool
,
config
,
io
)
...
@@ -420,7 +415,7 @@ def verify_installed_distribution(
...
@@ -420,7 +415,7 @@ def verify_installed_distribution(
def
test_executor_should_write_pep610_url_references_for_files
(
def
test_executor_should_write_pep610_url_references_for_files
(
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
Config
,
io
:
BufferedIO
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
"Config"
,
io
:
BufferedIO
):
):
url
=
(
url
=
(
Path
(
__file__
)
Path
(
__file__
)
...
@@ -439,7 +434,7 @@ def test_executor_should_write_pep610_url_references_for_files(
...
@@ -439,7 +434,7 @@ def test_executor_should_write_pep610_url_references_for_files(
def
test_executor_should_write_pep610_url_references_for_directories
(
def
test_executor_should_write_pep610_url_references_for_directories
(
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
Config
,
io
:
BufferedIO
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
"Config"
,
io
:
BufferedIO
):
):
url
=
Path
(
__file__
)
.
parent
.
parent
.
joinpath
(
"fixtures/simple_project"
)
.
resolve
()
url
=
Path
(
__file__
)
.
parent
.
parent
.
joinpath
(
"fixtures/simple_project"
)
.
resolve
()
package
=
Package
(
package
=
Package
(
...
@@ -454,7 +449,7 @@ def test_executor_should_write_pep610_url_references_for_directories(
...
@@ -454,7 +449,7 @@ def test_executor_should_write_pep610_url_references_for_directories(
def
test_executor_should_write_pep610_url_references_for_editable_directories
(
def
test_executor_should_write_pep610_url_references_for_editable_directories
(
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
Config
,
io
:
BufferedIO
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
config
:
"Config"
,
io
:
BufferedIO
):
):
url
=
Path
(
__file__
)
.
parent
.
parent
.
joinpath
(
"fixtures/simple_project"
)
.
resolve
()
url
=
Path
(
__file__
)
.
parent
.
parent
.
joinpath
(
"fixtures/simple_project"
)
.
resolve
()
package
=
Package
(
package
=
Package
(
...
@@ -475,7 +470,7 @@ def test_executor_should_write_pep610_url_references_for_editable_directories(
...
@@ -475,7 +470,7 @@ def test_executor_should_write_pep610_url_references_for_editable_directories(
def
test_executor_should_write_pep610_url_references_for_urls
(
def
test_executor_should_write_pep610_url_references_for_urls
(
tmp_venv
:
"VirtualEnv"
,
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
pool
:
Pool
,
config
:
Config
,
config
:
"Config"
,
io
:
BufferedIO
,
io
:
BufferedIO
,
mock_file_downloads
:
None
,
mock_file_downloads
:
None
,
):
):
...
@@ -496,7 +491,7 @@ def test_executor_should_write_pep610_url_references_for_urls(
...
@@ -496,7 +491,7 @@ def test_executor_should_write_pep610_url_references_for_urls(
def
test_executor_should_write_pep610_url_references_for_git
(
def
test_executor_should_write_pep610_url_references_for_git
(
tmp_venv
:
"VirtualEnv"
,
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
pool
:
Pool
,
config
:
Config
,
config
:
"Config"
,
io
:
BufferedIO
,
io
:
BufferedIO
,
mock_file_downloads
:
None
,
mock_file_downloads
:
None
,
):
):
...
@@ -528,7 +523,7 @@ def test_executor_should_write_pep610_url_references_for_git(
...
@@ -528,7 +523,7 @@ def test_executor_should_write_pep610_url_references_for_git(
def
test_executor_should_use_cached_link_and_hash
(
def
test_executor_should_use_cached_link_and_hash
(
tmp_venv
:
"VirtualEnv"
,
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
pool
:
Pool
,
config
:
Config
,
config
:
"Config"
,
io
:
BufferedIO
,
io
:
BufferedIO
,
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
fixture_dir
:
"FixtureDirGetter"
,
fixture_dir
:
"FixtureDirGetter"
,
...
@@ -575,7 +570,7 @@ def test_executor_should_use_cached_link_and_hash(
...
@@ -575,7 +570,7 @@ def test_executor_should_use_cached_link_and_hash(
def
test_executor_should_be_initialized_with_correct_workers
(
def
test_executor_should_be_initialized_with_correct_workers
(
tmp_venv
:
"VirtualEnv"
,
tmp_venv
:
"VirtualEnv"
,
pool
:
Pool
,
pool
:
Pool
,
config
:
Config
,
config
:
"Config"
,
io
:
BufferedIO
,
io
:
BufferedIO
,
mocker
:
"MockerFixture"
,
mocker
:
"MockerFixture"
,
max_workers
:
Optional
[
int
],
max_workers
:
Optional
[
int
],
...
@@ -583,7 +578,6 @@ def test_executor_should_be_initialized_with_correct_workers(
...
@@ -583,7 +578,6 @@ def test_executor_should_be_initialized_with_correct_workers(
side_effect
:
Optional
[
Exception
],
side_effect
:
Optional
[
Exception
],
expected_workers
:
int
,
expected_workers
:
int
,
):
):
config
=
Config
()
config
.
merge
({
"installer"
:
{
"max-workers"
:
max_workers
}})
config
.
merge
({
"installer"
:
{
"max-workers"
:
max_workers
}})
mocker
.
patch
(
"os.cpu_count"
,
return_value
=
cpu_count
,
side_effect
=
side_effect
)
mocker
.
patch
(
"os.cpu_count"
,
return_value
=
cpu_count
,
side_effect
=
side_effect
)
...
...
tests/installation/test_installer.py
View file @
e1b45f85
...
@@ -2254,7 +2254,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
...
@@ -2254,7 +2254,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
def
test_installer_can_handle_old_lock_files
(
def
test_installer_can_handle_old_lock_files
(
installer
:
Installer
,
locker
:
Locker
,
locker
:
Locker
,
package
:
ProjectPackage
,
package
:
ProjectPackage
,
repo
:
Repository
,
repo
:
Repository
,
...
...
tests/installation/test_installer_old.py
View file @
e1b45f85
...
@@ -1867,7 +1867,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
...
@@ -1867,7 +1867,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
def
test_installer_can_handle_old_lock_files
(
def
test_installer_can_handle_old_lock_files
(
installer
:
Installer
,
locker
:
Locker
,
locker
:
Locker
,
package
:
ProjectPackage
,
package
:
ProjectPackage
,
repo
:
Repository
,
repo
:
Repository
,
...
...
tests/puzzle/test_solver.py
View file @
e1b45f85
...
@@ -1878,7 +1878,6 @@ def test_solver_can_resolve_directory_dependencies(
...
@@ -1878,7 +1878,6 @@ def test_solver_can_resolve_directory_dependencies(
def
test_solver_can_resolve_directory_dependencies_nested_editable
(
def
test_solver_can_resolve_directory_dependencies_nested_editable
(
solver
:
Solver
,
repo
:
Repository
,
repo
:
Repository
,
pool
:
Pool
,
pool
:
Pool
,
installed
:
InstalledRepository
,
installed
:
InstalledRepository
,
...
@@ -2552,7 +2551,6 @@ def test_solver_does_not_loop_indefinitely_on_duplicate_constraints_with_extras(
...
@@ -2552,7 +2551,6 @@ def test_solver_does_not_loop_indefinitely_on_duplicate_constraints_with_extras(
def
test_solver_does_not_fail_with_locked_git_and_non_git_dependencies
(
def
test_solver_does_not_fail_with_locked_git_and_non_git_dependencies
(
solver
:
Solver
,
repo
:
Repository
,
repo
:
Repository
,
package
:
Package
,
package
:
Package
,
locked
:
Repository
,
locked
:
Repository
,
...
...
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