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

Run mypy on tests #77

Merged
merged 4 commits into from
May 28, 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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ on:
type: string
# renovate: datasource=pypi depName=ruff versioning=pep440
default: "0.4.5"
mypy-check-files:
required: false
description: extra files to check with mypy
type: string
default: ""
secrets:
PYPI_API_TOKEN:
required: true
Expand Down Expand Up @@ -94,6 +99,8 @@ jobs:
- name: Install root
run: poetry run pip install -e . --no-deps
- run: poetry run mypy
- if: ${{ inputs.mypy-check-files }}
run: poetry run mypy ${{ inputs.mypy-check-files }}

check_version:
name: Tag version bump
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
secrets: inherit
with:
lint: true
mypy-check-files: tests
1 change: 1 addition & 0 deletions ampel/base/AmpelUnit.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def dict(
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
warnings: bool = True,
) -> dict[str, Any]:

if hasattr(self, "__slots__"):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ampel-interface"
version = "0.10.1"
version = "0.10.1.post0"
description = "Base classes for the Ampel analysis platform"
authors = ["Valery Brinnel"]
maintainers = ["Jakob van Santen <jakob.van.santen@desy.de>"]
Expand Down
3 changes: 2 additions & 1 deletion tests/test_AmpelUnit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def __init__(self, **kwargs):

class Derived1(PrivateMixin, U, M): ...

class Derived2(PrivateMixin, M, U): ...
# ignore: Definition of "dict" in base class "BaseModel" is incompatible with definition in base class "AmpelUnit"
class Derived2(PrivateMixin, M, U): ... # type: ignore[misc]

kwargs = {"unit_param": 1, "basemodel_param": 2}
defaults = {"unit_param_with_default": 3, "basemodel_param_with_default": 2}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_AmpelVault.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_secret_resolution() -> None:


def test_value_set():
secret = NamedSecret(label="foo")
secret = NamedSecret[int](label="foo")
with pytest.raises(ValueError, match="Secret not yet resolved"):
secret.get()
secret.set(1)
Expand Down