summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-01-10 13:33:06 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-01-10 13:43:49 -0500
commitc9d473b05a1cdcd9d04185ee4fb4b86e1e5f08e3 (patch)
tree28ff1821f25039d20a2a3e373a0882cc47f30e61 /tests
parentb893cb31f43a9b598990c462cfaa2c8c66779153 (diff)
downloadpython-coveragepy-git-c9d473b05a1cdcd9d04185ee4fb4b86e1e5f08e3.tar.gz
mypy: install pytest alongside mypy to get its types
Diffstat (limited to 'tests')
-rw-r--r--tests/mixins.py8
-rw-r--r--tests/test_oddball.py1
-rw-r--r--tests/test_venv.py2
3 files changed, 6 insertions, 5 deletions
diff --git a/tests/mixins.py b/tests/mixins.py
index d207f779..c8f79d67 100644
--- a/tests/mixins.py
+++ b/tests/mixins.py
@@ -14,7 +14,7 @@ import os
import os.path
import sys
-from typing import Any, Callable, Iterable, Iterator, Optional, Tuple
+from typing import Any, Callable, Iterable, Iterator, Optional, Tuple, cast
import pytest
@@ -138,12 +138,12 @@ class StdStreamCapturingMixin:
def stdouterr(self) -> Tuple[str, str]:
"""Returns (out, err), two strings for stdout and stderr."""
- return self.capsys.readouterr() # type: ignore[no-any-return]
+ return cast(Tuple[str, str], self.capsys.readouterr())
def stdout(self) -> str:
"""Returns a string, the captured stdout."""
- return self.capsys.readouterr().out # type: ignore[no-any-return]
+ return self.capsys.readouterr().out
def stderr(self) -> str:
"""Returns a string, the captured stderr."""
- return self.capsys.readouterr().err # type: ignore[no-any-return]
+ return self.capsys.readouterr().err
diff --git a/tests/test_oddball.py b/tests/test_oddball.py
index a44beae4..23e3ce9d 100644
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -209,6 +209,7 @@ class MemoryFumblingTest(CoverageTest):
pytest.skip("This is too expensive for now (30s)")
# Start and stop coverage thousands of times to flush out bad
# reference counting, maybe.
+ _ = "this is just here to put a type comment on" # type: ignore[unreachable]
self.make_file("the_code.py", """\
import random
def f():
diff --git a/tests/test_venv.py b/tests/test_venv.py
index eb4ed5c0..de7ebbe1 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -48,7 +48,7 @@ def venv_world_fixture(tmp_path_factory: pytest.TempPathFactory) -> Path:
Returns the directory containing the "venv" virtualenv.
"""
- venv_world = cast(Path, tmp_path_factory.mktemp("venv_world"))
+ venv_world = tmp_path_factory.mktemp("venv_world")
with change_dir(venv_world):
# Create a virtualenv.
run_command("python -m venv venv")