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 #276

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ ci:
exclude: ^src/pdm/backend/_vendor
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.8.1'
rev: 'v0.9.4'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
exclude: ^(src/pdm/backend/_vendor|tests|scripts)
Expand Down
2 changes: 1 addition & 1 deletion src/pdm/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def evaluate_module_attribute(
matched = _attr_regex.match(expression)
if matched is None:
raise ConfigError(
"Invalid expression, must be in the format of " "`module:attribute`."
"Invalid expression, must be in the format of `module:attribute`."
)
with cm:
module = importlib.import_module(matched.group(1))
Expand Down
42 changes: 21 additions & 21 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@ def test_build_with_cextension(dist: Path) -> None:

zip_names = get_wheel_names(dist / wheel_name)
assert "my_package/__init__.py" in zip_names
assert (
"my_package/hellomodule.c" not in zip_names
), "Not collect c files while building wheel"
assert "my_package/hellomodule.c" not in zip_names, (
"Not collect c files while building wheel"
)
extension_suffix = ".pyd" if sys.platform == "win32" else ".so"
assert any(name.endswith(extension_suffix) for name in zip_names)

tar_names = get_tarball_names(dist / sdist_name)
assert "demo_package-0.1.0/my_package/__init__.py" in tar_names
assert (
"demo_package-0.1.0/my_package/hellomodule.c" in tar_names
), "Collect c files while building sdist"
assert not any(
path.startswith("build") for path in tar_names
), 'Not collect c files in temporary directory "./build"'
assert "demo_package-0.1.0/my_package/hellomodule.c" in tar_names, (
"Collect c files while building sdist"
)
assert not any(path.startswith("build") for path in tar_names), (
'Not collect c files in temporary directory "./build"'
)


@pytest.mark.parametrize("name", ["demo-cextension-in-src"])
Expand All @@ -277,20 +277,20 @@ def test_build_with_cextension_in_src(dist: Path) -> None:

zip_names = get_wheel_names(dist / wheel_name)
assert "my_package/__init__.py" in zip_names
assert (
"my_package/hellomodule.c" not in zip_names
), "Not collect c files while building wheel"
assert "my_package/hellomodule.c" not in zip_names, (
"Not collect c files while building wheel"
)
extension_suffix = ".pyd" if sys.platform == "win32" else ".so"
assert any(name.endswith(extension_suffix) for name in zip_names)

tar_names = get_tarball_names(dist / sdist_name)
assert "demo_package-0.1.0/src/my_package/__init__.py" in tar_names
assert (
"demo_package-0.1.0/src/my_package/hellomodule.c" in tar_names
), "Collect c files while building sdist"
assert not any(
path.startswith("build") for path in tar_names
), 'Not collect c files in temporary directory "./build"'
assert "demo_package-0.1.0/src/my_package/hellomodule.c" in tar_names, (
"Collect c files while building sdist"
)
assert not any(path.startswith("build") for path in tar_names), (
'Not collect c files in temporary directory "./build"'
)


@pytest.mark.parametrize("name", ["demo-package"])
Expand Down Expand Up @@ -329,9 +329,9 @@ def test_build_editable_src(dist: Path, fixture_project: Path) -> None:
namelist = zf.namelist()
assert "demo_package.pth" in namelist
assert "_editable_impl_demo_package.py" in namelist
assert (
"my_package/data.json" not in namelist
), "data files in proxy modules are excluded"
assert "my_package/data.json" not in namelist, (
"data files in proxy modules are excluded"
)
assert "data_out.json" in namelist

pth_content = zf.read("demo_package.pth").decode("utf-8").strip()
Expand Down