-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test against and fix for
pdm>=2.19
(#43)
- Loading branch information
1 parent
6073623
commit ce5cda4
Showing
8 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.0 | ||
hooks: | ||
- id: ruff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from __future__ import annotations | ||
|
||
import shutil | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from sync_pre_commit_lock import PRE_COMMIT_CONFIG_FILENAME | ||
|
||
pytest.importorskip("pdm") | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
|
||
from pdm.project import Project | ||
from pdm.pytest import PDMCallable | ||
|
||
|
||
@pytest.fixture | ||
def project(project: Project, fixtures: Path) -> Project: | ||
shutil.copy(fixtures / "pdm_project" / PRE_COMMIT_CONFIG_FILENAME, project.root) | ||
|
||
return project | ||
|
||
|
||
def test_pdm_lock(pdm: PDMCallable, project: Project): | ||
project.pyproject.settings["dev-dependencies"] = {"lint": ["ruff"]} | ||
project.pyproject.write() | ||
|
||
pdm("lock -v", obj=project, strict=True) | ||
|
||
pre_commit_config = (project.root / PRE_COMMIT_CONFIG_FILENAME).read_text() | ||
|
||
assert "rev: v" in pre_commit_config | ||
assert "rev: v0.1.0" not in pre_commit_config | ||
|
||
|
||
def test_pdm_install(pdm: PDMCallable, project: Project): | ||
# Needed by pdm 2.7 | ||
# See: https://github.com/pdm-project/pdm/issues/917 | ||
project.pyproject.metadata["requires-python"] = ">=3.9" | ||
project.pyproject.write() | ||
pdm("add ruff==0.6.7 -v", obj=project, strict=True) | ||
|
||
pre_commit_config = (project.root / PRE_COMMIT_CONFIG_FILENAME).read_text() | ||
|
||
assert "rev: v0.6.7" in pre_commit_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters