Skip to content

Commit

Permalink
ci: resolve mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKing committed Jun 13, 2024
1 parent 4258dfe commit 35f42fb
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .calcipy_packaging.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@
"version": "3.27.0"
},
"corallium": {
"datetime": "2024-06-07T09:07:04.610944+00:00",
"datetime": "2024-06-07T11:56:42.609084+00:00",
"domain": "https://pypi.org/pypi/{name}/json",
"latest_datetime": "2024-06-07T09:07:04.610944+00:00",
"latest_version": "1.0.3",
"latest_datetime": "2024-06-07T11:56:42.609084+00:00",
"latest_version": "2.0.0",
"name": "corallium",
"version": "1.0.3"
"version": "2.0.0"
},
"coverage": {
"datetime": "2024-05-28T14:03:57.019159+00:00",
Expand Down
10 changes: 10 additions & 0 deletions docs/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Unreleased

## 3.0.1 (2024-06-12)

### Fix

- don't pass arguments to pyright CLI

### Perf

- cache known executables

## 3.0.0 (2024-06-07)

### Fix
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ poetry config pypi-token.pypi ...
| `calcipy/tasks/cl.py` | 28 | 5 | 0 | 75.0% |
| `calcipy/tasks/defaults.py` | 20 | 0 | 0 | 89.3% |
| `calcipy/tasks/doc.py` | 45 | 0 | 8 | 90.5% |
| `calcipy/tasks/executable_utils.py` | 27 | 0 | 0 | 87.2% |
| `calcipy/tasks/executable_utils.py` | 34 | 0 | 0 | 89.6% |
| `calcipy/tasks/lint.py` | 44 | 2 | 0 | 82.9% |
| `calcipy/tasks/nox.py` | 8 | 0 | 0 | 100.0% |
| `calcipy/tasks/pack.py` | 42 | 11 | 0 | 64.1% |
| `calcipy/tasks/stale.py` | 6 | 0 | 0 | 100.0% |
| `calcipy/tasks/tags.py` | 18 | 1 | 0 | 91.7% |
| `calcipy/tasks/test.py` | 45 | 1 | 2 | 89.2% |
| `calcipy/tasks/types.py` | 20 | 0 | 0 | 89.3% |
| **Totals** | 1019 | 76 | 262 | 86.5% |
| `calcipy/tasks/types.py` | 14 | 0 | 0 | 90.0% |
| **Totals** | 1020 | 76 | 262 | 86.5% |

Generated on: 2024-06-07
Generated on: 2024-06-12
<!-- {cte} -->
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ basedpyright = {optional = true, version = ">=1.6.0"} # types
beartype = ">=0.18.2"
bidict = {optional = true, version = ">=0.22.1"} # stale
commitizen = {optional = true, version = ">=3.22.0"} # doc
corallium = ">=1.0.3"
corallium = ">=2.0.0"
griffe = {optional = true, version = ">=0.45.2"} # experimental
httpx = {optional = true, version = ">=0.24.1"} # stale
invoke = ">=2.2.0"
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import pytest
from beartype import beartype
from beartype.typing import Dict
from beartype.typing import Dict, Union
from invoke.context import MockContext

from .configuration import TEST_TMP_CACHE, clear_test_cache


@pytest.fixture(scope='module')
def vcr_config() -> Dict:
def vcr_config() -> Dict[str, Union[str, bool, list[str]]]:
"""Global configuration (https://github.com/kiwicom/pytest-recording) for `pytest-recording` (vcr).
Returns
Expand Down Expand Up @@ -51,10 +51,10 @@ def ctx() -> MockContext:
Adapted from:
https://github.com/pyinvoke/invocations/blob/8a277c304dd7aaad03888ee42d811c468e7fb37d/tests/conftest.py#L5-L11
https://github.com/pyinvoke/invocations/blob/4e3578e9c49dbbff2ec00ef3c8d37810fba511fa/tests/conftest.py#L13-L19
Documentation: https://docs.pyinvoke.org/en/stable/concepts/testing.html
"""
MockContext.run_command = property(lambda self: self.run.call_args[0][0])
MockContext.run_command = property(lambda self: self.run.call_args[0][0]) # type: ignore[attr-defined]
return MockContext(run=True)
2 changes: 1 addition & 1 deletion tests/noxfile/test_noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test__installable_dev_dependencies(monkeypatch):
def stubbed_read_pyproject() -> Dict:
def stubbed_read_pyproject() -> Dict: # type: ignore[type-arg]
return {
'tool': {
'poetry': {
Expand Down
18 changes: 7 additions & 11 deletions tests/tasks/test_tags.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# mypy: disable_error_code=type-arg

from pathlib import Path
from unittest.mock import call

import pytest
from beartype import beartype
from beartype.typing import Callable, Dict, List
from beartype.typing import Callable, Dict

from calcipy.tasks.tags import collect_code_tags
from tests.configuration import APP_DIR, TEST_DATA_DIR
Expand All @@ -29,7 +30,7 @@ def _check_output(kwargs: Dict) -> None:


@pytest.mark.parametrize(
('task', 'kwargs', 'commands', 'validator'),
('task', 'kwargs', 'validator'),
[
(collect_code_tags, {
'base_dir': APP_DIR.as_posix(),
Expand All @@ -38,25 +39,20 @@ def _check_output(kwargs: Dict) -> None:
'tag_order': 'FIXME,TODO',
'regex': '',
'ignore_patterns': '*.py,*.yaml,docs/docs/*.md',
}, [], _check_no_write),
}, _check_no_write),
(collect_code_tags, {
'base_dir': APP_DIR.as_posix(),
'doc_sub_dir': TEST_DATA_DIR.as_posix(),
'filename': 'test_tags.md.rej',
}, [], _check_output),
}, _check_output),
],
ids=[
'Check that no code tags were matched and no file was created',
'Check that no code tags were matched and no file was created',
],
)
@beartype
def test_tags(ctx, task, kwargs: Dict, commands: List[str], validator: Callable[[Dict], None]):
def test_tags(ctx, task, kwargs: Dict, validator: Callable[[Dict], None]):
task(ctx, **kwargs)

ctx.run.assert_has_calls([
call(cmd) if isinstance(cmd, str) else cmd
for cmd in commands
])

validator(kwargs)
2 changes: 1 addition & 1 deletion tests/test_scripts.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from calcipy.scripts import start_program # noqa: F401 # Smoke test the scripts import
from calcipy.scripts import start # noqa: F401 # Smoke test the scripts import

0 comments on commit 35f42fb

Please sign in to comment.