1515import sys
1616import tempfile
1717import time
18- from typing import AnyStr
18+ from typing import AnyStr , cast
1919
2020import pytest
2121
2525
2626
2727@pytest .fixture (scope = "module" )
28- def _testinfra_host (request ) :
29- return request .param
28+ def _testinfra_host (request : pytest . FixtureRequest ) -> testinfra . host . Host :
29+ return cast ( testinfra . host . Host , request .param )
3030
3131
3232@pytest .fixture (scope = "module" )
33- def host (_testinfra_host ) :
33+ def host (_testinfra_host : testinfra . host . Host ) -> testinfra . host . Host :
3434 return _testinfra_host
3535
3636
3737host .__doc__ = testinfra .host .Host .__doc__
3838
3939
40- def pytest_addoption (parser ) :
40+ def pytest_addoption (parser : pytest . Parser ) -> None :
4141 group = parser .getgroup ("testinfra" )
4242 group .addoption (
4343 "--connection" ,
@@ -107,7 +107,7 @@ def pytest_addoption(parser):
107107 )
108108
109109
110- def pytest_generate_tests (metafunc ) :
110+ def pytest_generate_tests (metafunc : pytest . Metafunc ) -> None :
111111 if "_testinfra_host" in metafunc .fixturenames :
112112 if metafunc .config .option .hosts is not None :
113113 hosts = metafunc .config .option .hosts .split ("," )
@@ -141,7 +141,7 @@ def __init__(self, out):
141141 self .total_time = None
142142 self .out = out
143143
144- def pytest_runtest_logreport (self , report ) :
144+ def pytest_runtest_logreport (self , report : pytest . TestReport ) -> None :
145145 if report .passed :
146146 if report .when == "call" : # ignore setup/teardown
147147 self .passed += 1
@@ -150,7 +150,7 @@ def pytest_runtest_logreport(self, report):
150150 elif report .skipped :
151151 self .skipped += 1
152152
153- def report (self ):
153+ def report (self ) -> int :
154154 if self .failed :
155155 status = b"CRITICAL"
156156 ret = 2
0 commit comments