@@ -133,7 +133,7 @@ def _prepare_cov_source(cov_source):
133133 return None if True in cov_source else [path for path in cov_source if path is not True ]
134134
135135
136- @pytest .mark . tryfirst
136+ @pytest .hookimpl ( tryfirst = True )
137137def pytest_load_initial_conftests (early_config , parser , args ):
138138 options = early_config .known_args_namespace
139139 no_cov = options .no_cov_should_warn = False
@@ -253,23 +253,23 @@ def pytest_sessionstart(self, session):
253253 if self .options .cov_context == 'test' :
254254 session .config .pluginmanager .register (TestContextPlugin (self .cov_controller .cov ), '_cov_contexts' )
255255
256+ @pytest .hookimpl (optionalhook = True )
256257 def pytest_configure_node (self , node ):
257258 """Delegate to our implementation.
258259
259260 Mark this hook as optional in case xdist is not installed.
260261 """
261262 if not self ._disabled :
262263 self .cov_controller .configure_node (node )
263- pytest_configure_node .optionalhook = True
264264
265+ @pytest .hookimpl (optionalhook = True )
265266 def pytest_testnodedown (self , node , error ):
266267 """Delegate to our implementation.
267268
268269 Mark this hook as optional in case xdist is not installed.
269270 """
270271 if not self ._disabled :
271272 self .cov_controller .testnodedown (node , error )
272- pytest_testnodedown .optionalhook = True
273273
274274 def _should_report (self ):
275275 return not (self .failed and self .options .no_cov_on_fail )
@@ -280,7 +280,7 @@ def _failed_cov_total(self):
280280
281281 # we need to wrap pytest_runtestloop. by the time pytest_sessionfinish
282282 # runs, it's too late to set testsfailed
283- @compat . hookwrapper
283+ @pytest . hookimpl ( hookwrapper = True )
284284 def pytest_runtestloop (self , session ):
285285 yield
286286
@@ -356,7 +356,7 @@ def pytest_runtest_setup(self, item):
356356 def pytest_runtest_teardown (self , item ):
357357 embed .cleanup ()
358358
359- @compat . hookwrapper
359+ @pytest . hookimpl ( hookwrapper = True )
360360 def pytest_runtest_call (self , item ):
361361 if (item .get_closest_marker ('no_cover' )
362362 or 'no_cover' in getattr (item , 'fixturenames' , ())):
0 commit comments