Skip to content
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 .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: d5da73e
_commit: '4372075'
_src_path: gh:python-project-templates/base
add_docs: false
add_extension: python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ lint-py: ## lint python with ruff
python -m ruff format --check copier_update

lint-docs: ## lint docs with mdformat and codespell
python -m mdformat --check README.md
python -m codespell_lib README.md
python -m mdformat --check README.md $(wildcard docs/src)
python -m codespell_lib README.md $(wildcard docs/src)

fix-py: ## autoformat python code with ruff
python -m ruff check --fix copier_update
python -m ruff format copier_update

fix-docs: ## autoformat docs with mdformat and codespell
python -m mdformat README.md
python -m codespell_lib --write README.md
python -m mdformat README.md $(wildcard docs/src)
python -m codespell_lib --write README.md $(wildcard docs/src)

lint: lint-py lint-docs ## run all linters
lints: lint
Expand All @@ -52,7 +52,7 @@ check-dist: ## check python sdist and wheel with check-dist
check-types: ## check python types with ty
ty check --python $$(which python)

checks: check-dist
checks: check-dist check-types

# Alias
check: checks
Expand Down
17 changes: 10 additions & 7 deletions copier_update/tests/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@

from typing import Any

from requests import Response, Session

from copier_update.github import GitHubAppClient, Installation, Repository


class FakeResponse:
class FakeResponse(Response):
def __init__(self, status_code: int, data: Any) -> None:
super().__init__()
self.status_code = status_code
self.data = data
self.ok = 200 <= status_code < 300
self.text = str(data)
self._content = str(data).encode()

def json(self) -> Any:
def json(self, **kwargs: Any) -> Any:
return self.data


class FakeSession:
class FakeSession(Session):
def __init__(self, *responses: FakeResponse) -> None:
super().__init__()
self.responses = list(responses)
self.requests: list[tuple[str, str, dict[str, Any]]] = []
self.requests: list[tuple[str, str | bytes, dict[str, Any]]] = []

def request(self, method: str, url: str, **kwargs: Any) -> FakeResponse:
def request(self, method: str, url: str | bytes, *args: Any, **kwargs: Any) -> FakeResponse:
self.requests.append((method, url, kwargs))
return self.responses.pop(0)

Expand Down
4 changes: 2 additions & 2 deletions copier_update/tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import pytest

from copier_update.github import Installation, Repository
from copier_update.github import GitHubAppClient, Installation, Repository
from copier_update.updater import Updater


class FakeClient:
class FakeClient(GitHubAppClient):
def __init__(self, repositories: list[Repository]) -> None:
self._repositories = repositories
self.answers = {repository.full_name: ".copier-answers.yaml" for repository in repositories}
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ develop = [
"codespell",
"hatchling",
"mdformat",
"mdformat-frontmatter",
"mdformat-tables>=1",
"pytest",
"pytest-cov",
Expand Down Expand Up @@ -77,7 +78,7 @@ replace = 'version = "{new_version}"'
[tool.coverage.run]
branch = true
omit = [
"copier_update/tests/integration/",
"copier_update/tests/integration/*",
]

[tool.coverage.report]
Expand Down