Skip to content

Commit 32704ea

Browse files
committed
Bump mypy version and python runtime, and increase annotation coverage.
1 parent 78909e2 commit 32704ea

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

repo_helper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use_whey: true
1515
enable_conda: False
1616
sphinx_html_theme: furo
1717
docs_fail_on_warning: true
18+
mypy_version: "1.8.0"
1819

1920
python_versions:
2021
- 3.7

tests/test_hooks.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# 3rd party
22
import pytest
33
from coincidence.selectors import not_pypy
4+
from domdf_python_tools.paths import PathPlus
45
from testing_tox import run_tox
56

67

78
@pytest.fixture()
8-
def basic_docs_testenv(tmp_pathplus):
9+
def basic_docs_testenv(tmp_pathplus: PathPlus) -> PathPlus:
910
build_dir = tmp_pathplus / "doc-source" / "build"
1011
build_dir.mkdir(parents=True)
1112

@@ -19,7 +20,7 @@ def basic_docs_testenv(tmp_pathplus):
1920
return build_dir
2021

2122

22-
def test_rmdir_docs(basic_docs_testenv, tmp_pathplus, capsys):
23+
def test_rmdir_docs(basic_docs_testenv: PathPlus, tmp_pathplus: PathPlus, capsys):
2324
with (tmp_pathplus / "tox.ini").open('a') as fp:
2425
fp.write('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n')
2526

@@ -36,7 +37,7 @@ def test_rmdir_docs(basic_docs_testenv, tmp_pathplus, capsys):
3637

3738

3839
@not_pypy("mypy does noy support PyPy")
39-
def test_rmdir_mypy(tmp_pathplus, capsys):
40+
def test_rmdir_mypy(tmp_pathplus: PathPlus, capsys):
4041

4142
cache_dir = tmp_pathplus / ".mypy_cache"
4243
cache_dir.mkdir()
@@ -60,7 +61,8 @@ def test_rmdir_mypy(tmp_pathplus, capsys):
6061
assert f"mypy recreate hook: removing {cache_dir}" in stdout
6162

6263

63-
def test_simple_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
64+
@pytest.mark.usefixtures("basic_docs_testenv")
65+
def test_simple_custom_hook(tmp_pathplus: PathPlus, capsys):
6466
with (tmp_pathplus / "tox.ini").open('a') as fp:
6567
fp.write('recreate_hook = "hello world"')
6668

@@ -73,7 +75,8 @@ def test_simple_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
7375
assert f"docs recreate hook: hello world" in stdout
7476

7577

76-
def test_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
78+
@pytest.mark.usefixtures("basic_docs_testenv")
79+
def test_custom_hook(tmp_pathplus: PathPlus, capsys):
7780
with (tmp_pathplus / "tox.ini").open('a') as fp:
7881
fp.write('recreate_hook = custom_hook.custom_hook()\n')
7982

@@ -91,7 +94,8 @@ def test_custom_hook(basic_docs_testenv, tmp_pathplus, capsys):
9194
assert f"docs recreate hook: this is a custom hook" in stdout
9295

9396

94-
def test_no_hook(basic_docs_testenv, tmp_pathplus, capsys):
97+
@pytest.mark.usefixtures("basic_docs_testenv")
98+
def test_no_hook(tmp_pathplus: PathPlus, capsys):
9599

96100
try:
97101
run_tox(["-e", "docs", "-r"], tmp_pathplus)
@@ -103,7 +107,7 @@ def test_no_hook(basic_docs_testenv, tmp_pathplus, capsys):
103107
assert "docs recreate hook: " not in stdout
104108

105109

106-
def test_not_recreate(basic_docs_testenv, tmp_pathplus, capsys):
110+
def test_not_recreate(basic_docs_testenv: PathPlus, tmp_pathplus: PathPlus, capsys):
107111
with (tmp_pathplus / "tox.ini").open('a') as fp:
108112
fp.write('recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")\n')
109113

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ basepython = python3.8
116116
ignore_errors = True
117117
changedir = {toxinidir}
118118
deps =
119-
mypy==0.971
119+
mypy==1.8.0
120120
-r{toxinidir}/tests/requirements.txt
121121
types-first
122122
commands = mypy tox_recreate_hook tests {posargs}

tox_recreate_hook/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
import sys
3232
from contextlib import contextmanager
3333
from importlib import import_module
34-
from typing import TYPE_CHECKING
34+
from typing import TYPE_CHECKING, Iterator
3535

3636
# 3rd party
37-
import pluggy # type: ignore
37+
import pluggy
3838
from domdf_python_tools.paths import in_directory
3939
from first import first
40-
from tox import reporter # type: ignore
40+
from tox import reporter # type: ignore[import-untyped]
4141

4242
# this package
4343
import tox_recreate_hook.hooks
@@ -48,9 +48,9 @@
4848

4949
# 3rd party
5050
from domdf_python_tools.typing import PathLike
51-
from tox.action import Action # type: ignore
52-
from tox.config import Config, TestenvConfig # type: ignore
53-
from tox.venv import VirtualEnv # type: ignore
51+
from tox.action import Action # type: ignore[import-untyped]
52+
from tox.config import Config, TestenvConfig # type: ignore[import-untyped]
53+
from tox.venv import VirtualEnv # type: ignore[import-untyped]
5454

5555
__author__: str = "Dominic Davis-Foster"
5656
__copyright__: str = "2021 Dominic Davis-Foster"
@@ -64,7 +64,7 @@
6464

6565

6666
@contextmanager
67-
def append_to_sys_path(path: "PathLike"):
67+
def append_to_sys_path(path: "PathLike") -> Iterator[None]:
6868
"""
6969
Append ``path`` to :py:obj:`sys.path` for the scope of the :keyword:`with` block.
7070

0 commit comments

Comments
 (0)