summaryrefslogtreecommitdiff
path: root/src/_pytest/unittest.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-10-05 18:13:05 -0700
committerAnthony Sottile <asottile@umich.edu>2020-10-05 18:33:17 -0700
commit33d119f71a60d1b41686c04a52c3a570fdcd506c (patch)
tree860431d60652d573998855f45b1ca868700032b1 /src/_pytest/unittest.py
parent703e89134c2b0c21225014e3a89c17ab062c0ab9 (diff)
downloadpytest-33d119f71a60d1b41686c04a52c3a570fdcd506c.tar.gz
py36+: com2ann
Diffstat (limited to 'src/_pytest/unittest.py')
-rw-r--r--src/_pytest/unittest.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index 62c6e90b7..6dc404a39 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -55,7 +55,7 @@ def pytest_pycollect_makeitem(
except Exception:
return None
# Yes, so let's collect it.
- item = UnitTestCase.from_parent(collector, name=name, obj=obj) # type: UnitTestCase
+ item: UnitTestCase = UnitTestCase.from_parent(collector, name=name, obj=obj)
return item
@@ -141,12 +141,12 @@ def _make_xunit_fixture(
class TestCaseFunction(Function):
nofuncargs = True
- _excinfo = None # type: Optional[List[_pytest._code.ExceptionInfo[BaseException]]]
- _testcase = None # type: Optional[unittest.TestCase]
+ _excinfo: Optional[List[_pytest._code.ExceptionInfo[BaseException]]] = None
+ _testcase: Optional["unittest.TestCase"] = None
def setup(self) -> None:
# A bound method to be called during teardown() if set (see 'runtest()').
- self._explicit_tearDown = None # type: Optional[Callable[[], None]]
+ self._explicit_tearDown: Optional[Callable[[], None]] = None
assert self.parent is not None
self._testcase = self.parent.obj(self.name) # type: ignore[attr-defined]
self._obj = getattr(self._testcase, self.name)
@@ -320,7 +320,7 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
@hookimpl(hookwrapper=True)
def pytest_runtest_protocol(item: Item) -> Generator[None, None, None]:
if isinstance(item, TestCaseFunction) and "twisted.trial.unittest" in sys.modules:
- ut = sys.modules["twisted.python.failure"] # type: Any
+ ut: Any = sys.modules["twisted.python.failure"]
Failure__init__ = ut.Failure.__init__
check_testcase_implements_trial_reporter()