summaryrefslogtreecommitdiff
path: root/testing/test_unittest.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-05-01 14:40:17 +0300
committerRan Benita <ran@unusedvar.com>2020-06-05 11:34:20 +0300
commit54ad048be7182018e70479bd3d9b88bcb6376c00 (patch)
tree3681812c6c7e9dd9acd7c27a9b369ee860835e13 /testing/test_unittest.py
parent71dfdca4df6961460653c265026e194fbcaebef2 (diff)
downloadpytest-54ad048be7182018e70479bd3d9b88bcb6376c00.tar.gz
Enable check_untyped_defs mypy option for testing/ too
Diffstat (limited to 'testing/test_unittest.py')
-rw-r--r--testing/test_unittest.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/testing/test_unittest.py b/testing/test_unittest.py
index 74a36c41b..6ddc6186b 100644
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -1,4 +1,5 @@
import gc
+from typing import List
import pytest
from _pytest.config import ExitCode
@@ -1158,13 +1159,13 @@ def test_trace(testdir, monkeypatch):
assert result.ret == 0
-def test_pdb_teardown_called(testdir, monkeypatch):
+def test_pdb_teardown_called(testdir, monkeypatch) -> None:
"""Ensure tearDown() is always called when --pdb is given in the command-line.
We delay the normal tearDown() calls when --pdb is given, so this ensures we are calling
tearDown() eventually to avoid memory leaks when using --pdb.
"""
- teardowns = []
+ teardowns = [] # type: List[str]
monkeypatch.setattr(
pytest, "test_pdb_teardown_called_teardowns", teardowns, raising=False
)
@@ -1194,11 +1195,11 @@ def test_pdb_teardown_called(testdir, monkeypatch):
@pytest.mark.parametrize("mark", ["@unittest.skip", "@pytest.mark.skip"])
-def test_pdb_teardown_skipped(testdir, monkeypatch, mark):
+def test_pdb_teardown_skipped(testdir, monkeypatch, mark: str) -> None:
"""
With --pdb, setUp and tearDown should not be called for skipped tests.
"""
- tracked = []
+ tracked = [] # type: List[str]
monkeypatch.setattr(pytest, "test_pdb_teardown_skipped", tracked, raising=False)
testdir.makepyfile(