Skip to content

Commit

Permalink
Add mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Jul 17, 2023
1 parent ff5e00c commit 02eb9c4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
use flake
watch_file pyproject.toml
11 changes: 6 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@
touch $out
'';
in
{
pytest = mkCheck "pytest" "pytest --workers auto";
treefmt = mkCheck "treefmt" "treefmt --no-cache --fail-on-change";
deadnix = mkCheck "deadnix" "deadnix --fail";
statix = mkCheck "statix" "statix check";
lib.mapAttrs mkCheck {
pytest = "pytest --workers auto";
treefmt = "treefmt --no-cache --fail-on-change";
deadnix = "deadnix --fail";
statix = "statix check";
mypy = "mypy .";
};

});
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ dev = [
"pytest>=7.2.1",
"pytest-parallel>=0.1.1",
"black>=23.7.0",
"mypy>=1.4.1",
]
6 changes: 3 additions & 3 deletions tests/test_nix.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import (
Iterator,
Optional,
Tuple,
Dict,
List,
cast,
Set,
Any,
)
Expand All @@ -16,7 +16,7 @@ def assert_deepequals(
a: Any,
b: Any,
ignore_paths: Optional[Set[str]] = None,
_path: Optional[Tuple[str]] = None,
_path: Optional[tuple[str]] = None,
):
"""Compare objects a and b keeping track of object path for error reporting.
Expand All @@ -37,7 +37,7 @@ def assert_deepequals(
}, ignore_paths=set(["metadata.poetry-version"]))
"""

_path = _path if _path else tuple()
_path = cast(tuple[str], (_path if _path else tuple()))
ignore_paths = ignore_paths if ignore_paths else set()
path = ".".join(_path)
err = ValueError("{}: {} != {}".format(path, a, b))
Expand Down

0 comments on commit 02eb9c4

Please sign in to comment.