From 25064eba7a742bc1bbcef370e2e0f44f40bc0bde Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 13 Jun 2020 14:15:54 +0300 Subject: [PATCH] pytest.collect: type annotate (backward compat module) This is just to satisfy typing coverage. --- src/pytest/collect.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pytest/collect.py b/src/pytest/collect.py index 73c9d35a0..ec9c2d8b4 100644 --- a/src/pytest/collect.py +++ b/src/pytest/collect.py @@ -1,6 +1,8 @@ import sys import warnings from types import ModuleType +from typing import Any +from typing import List import pytest from _pytest.deprecated import PYTEST_COLLECT_MODULE @@ -20,15 +22,15 @@ COLLECT_FAKEMODULE_ATTRIBUTES = [ class FakeCollectModule(ModuleType): - def __init__(self): + def __init__(self) -> None: super().__init__("pytest.collect") self.__all__ = list(COLLECT_FAKEMODULE_ATTRIBUTES) self.__pytest = pytest - def __dir__(self): + def __dir__(self) -> List[str]: return dir(super()) + self.__all__ - def __getattr__(self, name): + def __getattr__(self, name: str) -> Any: if name not in self.__all__: raise AttributeError(name) warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2)