Commit e1b45f85 by Arun Babu Neelicattu Committed by Bjorn Neergaard

lint: fix semantic bugs in codebase

parent 19c472aa
......@@ -176,12 +176,6 @@ class Incompatibility:
if len(self._terms) == 1:
term = self._terms[0]
if term.constraint.is_any():
return "{} is {}".format(
term.dependency.name,
"forbidden" if term.is_positive() else "required",
)
else:
return "{} is {}".format(
term.dependency.name,
"forbidden" if term.is_positive() else "required",
......
......@@ -1719,8 +1719,6 @@ class GenericEnv(VirtualEnv):
if pip_executable.endswith(".exe"):
pip_executable = pip_executable[:-4]
pip_executable = pip_executable
if python_executable:
self._executable = python_executable
......
......@@ -68,16 +68,16 @@ def install_plugin(env: "MockEnv", installed: "Repository", pyproject: None) ->
tomlkit.dumps(lock_content), encoding="utf-8"
)
pyproject = tomlkit.loads(
pyproject_toml = tomlkit.loads(
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["poetry-plugin"] = "^1.2.3"
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"))
......
......@@ -19,7 +19,6 @@ from poetry.core.packages.package import Package
from poetry.core.packages.utils.link import Link
from poetry.core.utils._compat import PY36
from poetry.config.config import Config
from poetry.installation.executor import Executor
from poetry.installation.operations import Install
from poetry.installation.operations import Uninstall
......@@ -35,6 +34,7 @@ if TYPE_CHECKING:
from httpretty.core import HTTPrettyRequest
from pytest_mock import MockerFixture
from poetry.config.config import Config
from poetry.utils.env import VirtualEnv
from tests.types import FixtureDirGetter
......@@ -103,7 +103,7 @@ def mock_file_downloads(http: Type["httpretty.httpretty"]) -> None:
def test_execute_executes_a_batch_of_operations(
mocker: "MockerFixture",
config: Config,
config: "Config",
pool: Pool,
io: BufferedIO,
tmp_dir: str,
......@@ -114,7 +114,6 @@ def test_execute_executes_a_batch_of_operations(
"poetry.installation.executor.pip_editable_install", unsafe=not PY36
)
config = Config()
config.merge({"cache-dir": tmp_dir})
executor = Executor(env, pool, config, io)
......@@ -184,9 +183,8 @@ Package operations: 4 installs, 1 update, 1 removal
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()})
executor = Executor(env, pool, config, io)
......@@ -209,7 +207,7 @@ Package operations: 0 installs, 0 updates, 0 removals, 1 skipped
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.verbose()
......@@ -233,14 +231,13 @@ Package operations: 1 install, 0 updates, 0 removals
def test_execute_works_with_ansi_output(
mocker: "MockerFixture",
config: Config,
config: "Config",
pool: Pool,
io_decorated: BufferedIO,
tmp_dir: str,
mock_file_downloads: None,
env: MockEnv,
):
config = Config()
config.merge({"cache-dir": tmp_dir})
executor = Executor(env, pool, config, io_decorated)
......@@ -273,14 +270,13 @@ def test_execute_works_with_ansi_output(
def test_execute_works_with_no_ansi_output(
mocker: "MockerFixture",
config: Config,
config: "Config",
pool: Pool,
io_not_decorated: BufferedIO,
tmp_dir: str,
mock_file_downloads: None,
env: MockEnv,
):
config = Config()
config.merge({"cache-dir": tmp_dir})
executor = Executor(env, pool, config, io_not_decorated)
......@@ -308,7 +304,7 @@ Package operations: 1 install, 0 updates, 0 removals
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.verbose()
......@@ -329,7 +325,7 @@ Package operations: 1 install, 0 updates, 0 removals
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.verbose()
......@@ -356,7 +352,7 @@ Package operations: 1 install, 0 updates, 0 removals
def test_executor_should_delete_incomplete_downloads(
config: Config,
config: "Config",
io: BufferedIO,
tmp_dir: str,
mocker: "MockerFixture",
......@@ -382,7 +378,6 @@ def test_executor_should_delete_incomplete_downloads(
return_value=Path(tmp_dir),
)
config = Config()
config.merge({"cache-dir": tmp_dir})
executor = Executor(env, pool, config, io)
......@@ -420,7 +415,7 @@ def verify_installed_distribution(
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 = (
Path(__file__)
......@@ -439,7 +434,7 @@ def test_executor_should_write_pep610_url_references_for_files(
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()
package = Package(
......@@ -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(
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()
package = Package(
......@@ -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(
tmp_venv: "VirtualEnv",
pool: Pool,
config: Config,
config: "Config",
io: BufferedIO,
mock_file_downloads: None,
):
......@@ -496,7 +491,7 @@ def test_executor_should_write_pep610_url_references_for_urls(
def test_executor_should_write_pep610_url_references_for_git(
tmp_venv: "VirtualEnv",
pool: Pool,
config: Config,
config: "Config",
io: BufferedIO,
mock_file_downloads: None,
):
......@@ -528,7 +523,7 @@ def test_executor_should_write_pep610_url_references_for_git(
def test_executor_should_use_cached_link_and_hash(
tmp_venv: "VirtualEnv",
pool: Pool,
config: Config,
config: "Config",
io: BufferedIO,
mocker: "MockerFixture",
fixture_dir: "FixtureDirGetter",
......@@ -575,7 +570,7 @@ def test_executor_should_use_cached_link_and_hash(
def test_executor_should_be_initialized_with_correct_workers(
tmp_venv: "VirtualEnv",
pool: Pool,
config: Config,
config: "Config",
io: BufferedIO,
mocker: "MockerFixture",
max_workers: Optional[int],
......@@ -583,7 +578,6 @@ def test_executor_should_be_initialized_with_correct_workers(
side_effect: Optional[Exception],
expected_workers: int,
):
config = Config()
config.merge({"installer": {"max-workers": max_workers}})
mocker.patch("os.cpu_count", return_value=cpu_count, side_effect=side_effect)
......
......@@ -2254,7 +2254,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
def test_installer_can_handle_old_lock_files(
installer: Installer,
locker: Locker,
package: ProjectPackage,
repo: Repository,
......
......@@ -1867,7 +1867,6 @@ def test_installer_uses_prereleases_if_they_are_compatible(
def test_installer_can_handle_old_lock_files(
installer: Installer,
locker: Locker,
package: ProjectPackage,
repo: Repository,
......
......@@ -1878,7 +1878,6 @@ def test_solver_can_resolve_directory_dependencies(
def test_solver_can_resolve_directory_dependencies_nested_editable(
solver: Solver,
repo: Repository,
pool: Pool,
installed: InstalledRepository,
......@@ -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(
solver: Solver,
repo: Repository,
package: Package,
locked: Repository,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment