summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-03-07 11:00:59 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-03-07 11:00:59 -0500
commitd76daad2f184a0c9ec4dc8e80e4ca20ea9e39d7c (patch)
tree16d3d0a68dfba4bd41098f8c71c83d5f37efb409
parent489579769acc2f0bf41b220773c13fde2b550770 (diff)
downloadpython-coveragepy-git-d76daad2f184a0c9ec4dc8e80e4ca20ea9e39d7c.tar.gz
build: run mypy by default, and fix "unused" errors from updated mypy
-rw-r--r--coverage/execfile.py2
-rw-r--r--tests/coveragetest.py6
-rw-r--r--tox.ini2
3 files changed, 5 insertions, 5 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py
index 66cf931c..ef0277d6 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -294,7 +294,7 @@ def make_code_from_py(filename: str) -> CodeType:
except (OSError, NoSource) as exc:
raise NoSource(f"No file to run: '{filename}'") from exc
- return compile(source, filename, "exec", dont_inherit=True) # type: ignore[no-any-return]
+ return compile(source, filename, "exec", dont_inherit=True)
def make_code_from_pyc(filename: str) -> CodeType:
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index 0055c691..cec565ef 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -293,7 +293,7 @@ class CoverageTest(
def capture_warning(
msg: str,
slug: Optional[str] = None,
- once: bool = False, # pylint: disable=unused-argument
+ once: bool = False, # pylint: disable=unused-argument
) -> None:
"""A fake implementation of Coverage._warn, to capture warnings."""
# NOTE: we don't implement `once`.
@@ -302,7 +302,7 @@ class CoverageTest(
saved_warnings.append(msg)
original_warn = cov._warn
- cov._warn = capture_warning # type: ignore[assignment]
+ cov._warn = capture_warning # type: ignore[method-assign]
try:
yield
@@ -327,7 +327,7 @@ class CoverageTest(
if saved_warnings:
assert False, f"Unexpected warnings: {saved_warnings!r}"
finally:
- cov._warn = original_warn # type: ignore[assignment]
+ cov._warn = original_warn # type: ignore[method-assign]
def assert_same_files(self, flist1: Iterable[str], flist2: Iterable[str]) -> None:
"""Assert that `flist1` and `flist2` are the same set of file names."""
diff --git a/tox.ini b/tox.ini
index 70b56a3f..0a1fa6f6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
[tox]
# When changing this list, be sure to check the [gh] list below.
# PYVERSIONS
-envlist = py{37,38,39,310,311,312}, pypy3, doc, lint
+envlist = py{37,38,39,310,311,312}, pypy3, doc, lint, mypy
skip_missing_interpreters = {env:COVERAGE_SKIP_MISSING_INTERPRETERS:True}
toxworkdir = {env:TOXWORKDIR:.tox}