Skip to content

Commit d76daad

Browse files
committedMar 7, 2023
build: run mypy by default, and fix "unused" errors from updated mypy
1 parent 4895797 commit d76daad

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
 

‎coverage/execfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def make_code_from_py(filename: str) -> CodeType:
294294
except (OSError, NoSource) as exc:
295295
raise NoSource(f"No file to run: '{filename}'") from exc
296296

297-
return compile(source, filename, "exec", dont_inherit=True) # type: ignore[no-any-return]
297+
return compile(source, filename, "exec", dont_inherit=True)
298298

299299

300300
def make_code_from_pyc(filename: str) -> CodeType:

‎tests/coveragetest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def assert_warnings(
293293
def capture_warning(
294294
msg: str,
295295
slug: Optional[str] = None,
296-
once: bool = False, # pylint: disable=unused-argument
296+
once: bool = False, # pylint: disable=unused-argument
297297
) -> None:
298298
"""A fake implementation of Coverage._warn, to capture warnings."""
299299
# NOTE: we don't implement `once`.
@@ -302,7 +302,7 @@ def capture_warning(
302302
saved_warnings.append(msg)
303303

304304
original_warn = cov._warn
305-
cov._warn = capture_warning # type: ignore[assignment]
305+
cov._warn = capture_warning # type: ignore[method-assign]
306306

307307
try:
308308
yield
@@ -327,7 +327,7 @@ def capture_warning(
327327
if saved_warnings:
328328
assert False, f"Unexpected warnings: {saved_warnings!r}"
329329
finally:
330-
cov._warn = original_warn # type: ignore[assignment]
330+
cov._warn = original_warn # type: ignore[method-assign]
331331

332332
def assert_same_files(self, flist1: Iterable[str], flist2: Iterable[str]) -> None:
333333
"""Assert that `flist1` and `flist2` are the same set of file names."""

‎tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[tox]
55
# When changing this list, be sure to check the [gh] list below.
66
# PYVERSIONS
7-
envlist = py{37,38,39,310,311,312}, pypy3, doc, lint
7+
envlist = py{37,38,39,310,311,312}, pypy3, doc, lint, mypy
88
skip_missing_interpreters = {env:COVERAGE_SKIP_MISSING_INTERPRETERS:True}
99
toxworkdir = {env:TOXWORKDIR:.tox}
1010

0 commit comments

Comments
 (0)