pytest.collect: type annotate (backward compat module)
This is just to satisfy typing coverage.
This commit is contained in:
		
							parent
							
								
									ab6dacf1d1
								
							
						
					
					
						commit
						25064eba7a
					
				| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import warnings
 | 
					import warnings
 | 
				
			||||||
from types import ModuleType
 | 
					from types import ModuleType
 | 
				
			||||||
 | 
					from typing import Any
 | 
				
			||||||
 | 
					from typing import List
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import pytest
 | 
					import pytest
 | 
				
			||||||
from _pytest.deprecated import PYTEST_COLLECT_MODULE
 | 
					from _pytest.deprecated import PYTEST_COLLECT_MODULE
 | 
				
			||||||
| 
						 | 
					@ -20,15 +22,15 @@ COLLECT_FAKEMODULE_ATTRIBUTES = [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FakeCollectModule(ModuleType):
 | 
					class FakeCollectModule(ModuleType):
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self) -> None:
 | 
				
			||||||
        super().__init__("pytest.collect")
 | 
					        super().__init__("pytest.collect")
 | 
				
			||||||
        self.__all__ = list(COLLECT_FAKEMODULE_ATTRIBUTES)
 | 
					        self.__all__ = list(COLLECT_FAKEMODULE_ATTRIBUTES)
 | 
				
			||||||
        self.__pytest = pytest
 | 
					        self.__pytest = pytest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __dir__(self):
 | 
					    def __dir__(self) -> List[str]:
 | 
				
			||||||
        return dir(super()) + self.__all__
 | 
					        return dir(super()) + self.__all__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __getattr__(self, name):
 | 
					    def __getattr__(self, name: str) -> Any:
 | 
				
			||||||
        if name not in self.__all__:
 | 
					        if name not in self.__all__:
 | 
				
			||||||
            raise AttributeError(name)
 | 
					            raise AttributeError(name)
 | 
				
			||||||
        warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2)
 | 
					        warnings.warn(PYTEST_COLLECT_MODULE.format(name=name), stacklevel=2)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue