Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #8922

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: check-docstring-first

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
exclude: tests/([^/]*/)*fixtures/
Expand Down
6 changes: 4 additions & 2 deletions src/poetry/console/commands/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def handle(self) -> int:
# that.
version: Callable[[str], str] = metadata.version

self.line(f"""\
self.line(
f"""\
<info>Poetry - Package Management for Python
Version: {version('poetry')}
Expand All @@ -30,6 +31,7 @@ def handle(self) -> int:
<comment>Poetry is a dependency manager tracking local dependencies of your projects\
and libraries.
See <fg=blue>https://github.com/python-poetry/poetry</> for more information.</comment>\
""")
"""
)

return 0
12 changes: 8 additions & 4 deletions tests/console/commands/self/test_add_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def test_add_existing_plugin_warns_about_no_operation(
) -> None:
pyproject = SelfCommand.get_default_system_pyproject_file()
with open(pyproject, "w", encoding="utf-8", newline="") as f:
f.write(f"""\
f.write(
f"""\
[tool.poetry]
name = "poetry-instance"
version = "1.2.0"
Expand All @@ -207,7 +208,8 @@ def test_add_existing_plugin_warns_about_no_operation(

[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
poetry-plugin = "^1.2.3"
""")
"""
)

installed.add_package(Package("poetry-plugin", "1.2.3"))

Expand Down Expand Up @@ -235,7 +237,8 @@ def test_add_existing_plugin_updates_if_requested(
) -> None:
pyproject = SelfCommand.get_default_system_pyproject_file()
with open(pyproject, "w", encoding="utf-8", newline="") as f:
f.write(f"""\
f.write(
f"""\
[tool.poetry]
name = "poetry-instance"
version = "1.2.0"
Expand All @@ -247,7 +250,8 @@ def test_add_existing_plugin_updates_if_requested(

[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
poetry-plugin = "^1.2.3"
""")
"""
)

installed.add_package(Package("poetry-plugin", "1.2.3"))

Expand Down
3 changes: 1 addition & 2 deletions tests/console/commands/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ def test_set_malformed_repositories_setting(
tester.execute("repositories.foo bar baz")

assert (
str(e.value)
== "You must pass the url. Example: poetry config repositories.foo"
str(e.value) == "You must pass the url. Example: poetry config repositories.foo"
" https://bar.com"
)

Expand Down
4 changes: 3 additions & 1 deletion tests/console/commands/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,9 @@ def test_init_existing_pyproject_consistent_linesep(
existing_section = """
[tool.black]
line-length = 88
""".replace("\n", linesep)
""".replace(
"\n", linesep
)
with open(pyproject_file, "w", newline="") as f:
f.write(existing_section)
tester.execute(inputs=init_basic_inputs)
Expand Down
3 changes: 1 addition & 2 deletions tests/console/commands/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ def test_remove_untracked_outputs_deprecation_warning(
assert tester.status_code == 0
assert (
"The `--remove-untracked` option is deprecated, use the `--sync` option"
" instead.\n"
in tester.io.fetch_error()
" instead.\n" in tester.io.fetch_error()
)


Expand Down
24 changes: 16 additions & 8 deletions tests/console/commands/test_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ def test_remove_without_specific_group_removes_from_all_groups(

pyproject: dict[str, Any] = app.poetry.file.read()

groups_content: dict[str, Any] = tomlkit.parse("""\
groups_content: dict[str, Any] = tomlkit.parse(
"""\
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
baz = "^1.0.0"

""")
"""
)
pyproject["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
pyproject["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
pyproject = cast("TOMLDocument", pyproject)
Expand Down Expand Up @@ -123,12 +125,14 @@ def test_remove_without_specific_group_removes_from_specific_groups(

pyproject: dict[str, Any] = app.poetry.file.read()

groups_content: dict[str, Any] = tomlkit.parse("""\
groups_content: dict[str, Any] = tomlkit.parse(
"""\
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
baz = "^1.0.0"

""")
"""
)
pyproject["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
pyproject["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
pyproject = cast("TOMLDocument", pyproject)
Expand Down Expand Up @@ -180,12 +184,14 @@ def test_remove_does_not_live_empty_groups(

content: dict[str, Any] = app.poetry.file.read()

groups_content: dict[str, Any] = tomlkit.parse("""\
groups_content: dict[str, Any] = tomlkit.parse(
"""\
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
baz = "^1.0.0"

""")
"""
)
content["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
content["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
content = cast("TOMLDocument", content)
Expand Down Expand Up @@ -226,12 +232,14 @@ def test_remove_canonicalized_named_removes_dependency_correctly(

pyproject: dict[str, Any] = app.poetry.file.read()

groups_content: dict[str, Any] = tomlkit.parse("""\
groups_content: dict[str, Any] = tomlkit.parse(
"""\
[tool.poetry.group.bar.dependencies]
foo-bar = "^2.0.0"
baz = "^1.0.0"

""")
"""
)
pyproject["tool"]["poetry"]["dependencies"]["foo-bar"] = "^2.0.0"
pyproject["tool"]["poetry"].value._insert_after(
"dependencies", "group", groups_content["tool"]["poetry"]["group"]
Expand Down
12 changes: 8 additions & 4 deletions tests/inspection/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,24 @@ def demo_setup_complex_calls_script(
shutil.copytree(fixture_dir("scripts"), scripts_dir)

pyproject = source_dir / "pyproject.toml"
pyproject.write_text(f"""\
pyproject.write_text(
f"""\
[build-system]
requires = ["setuptools", "scripts @ {scripts_dir.as_uri()}"]
build-backend = "setuptools.build_meta:__legacy__"
""")
"""
)

setup_py = source_dir / "setup.py"
setup_py.write_text("""\
setup_py.write_text(
"""\
import subprocess
from setuptools import setup
if subprocess.call(["exit-code"]) != 42:
raise RuntimeError("Wrong exit code.")
setup(name="demo", version="0.1.0", install_requires=[i for i in ["package"]])
""")
"""
)

return source_dir

Expand Down
3 changes: 1 addition & 2 deletions tests/packages/test_locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,7 @@ def test_reading_lock_file_should_raise_an_error_on_missing_metadata(

assert (
"The lock file does not have a metadata entry.\nRegenerate the lock file with"
" the `poetry lock` command."
in str(e.value)
" the `poetry lock` command." in str(e.value)
)


Expand Down
3 changes: 1 addition & 2 deletions tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4393,8 +4393,7 @@ def test_solver_yanked_warning(
assert "The locked version 2 for bar is a yanked version." in error
assert (
"The locked version 3 for baz is a yanked version. Reason for being yanked:"
" just wrong"
in error
" just wrong" in error
)
assert error.count("is a yanked version") == 2
assert error.count("Reason for being yanked") == 1
Expand Down
6 changes: 4 additions & 2 deletions tests/utils/env/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ def test_call_does_not_block_on_full_pipe(
) -> None:
"""see https://github.com/python-poetry/poetry/issues/7698"""
script = tmp_path / "script.py"
script.write_text(f"""\
script.write_text(
f"""\
import sys
for i in range(10000):
print('just print a lot of text to fill the buffer', file={out})
""")
"""
)

def target(result: list[int]) -> None:
tmp_venv.run("python", str(script), call=True)
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/test_setup_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_setup_reader_read_minimal_setup_py(setup: Callable[[str], Path]) -> Non


def test_setup_reader_read_first_level_setup_call_with_direct_types(
setup: Callable[[str], Path]
setup: Callable[[str], Path],
) -> None:
result = SetupReader.read_from_directory(setup("flask"))

Expand Down Expand Up @@ -77,7 +77,7 @@ def test_setup_reader_read_first_level_setup_call_with_direct_types(


def test_setup_reader_read_first_level_setup_call_with_variables(
setup: Callable[[str], Path]
setup: Callable[[str], Path],
) -> None:
result = SetupReader.read_from_directory(setup("requests"))

Expand Down Expand Up @@ -106,7 +106,7 @@ def test_setup_reader_read_first_level_setup_call_with_variables(


def test_setup_reader_read_sub_level_setup_call_with_direct_types(
setup: Callable[[str], Path]
setup: Callable[[str], Path],
) -> None:
result = SetupReader.read_from_directory(setup("sqlalchemy"))

Expand Down Expand Up @@ -214,7 +214,7 @@ def test_setup_reader_read_setup_call_in_main(setup: Callable[[str], Path]) -> N


def test_setup_reader_read_extras_require_with_variables(
setup: Callable[[str], Path]
setup: Callable[[str], Path],
) -> None:
result = SetupReader.read_from_directory(setup("extras_require_with_vars"))

Expand Down
Loading