11
11
import time
12
12
13
13
import py
14
- import _pytest .hookspec
15
14
import pytest
16
15
from execnet .gateway_base import dumps , DumpError
17
16
@@ -101,11 +100,8 @@ def pytest_collection_finish(self, session):
101
100
def pytest_runtest_logstart (self , nodeid , location ):
102
101
self .sendevent ("logstart" , nodeid = nodeid , location = location )
103
102
104
- # the pytest_runtest_logfinish hook was introduced in pytest 3.4
105
- if hasattr (_pytest .hookspec , "pytest_runtest_logfinish" ):
106
-
107
- def pytest_runtest_logfinish (self , nodeid , location ):
108
- self .sendevent ("logfinish" , nodeid = nodeid , location = location )
103
+ def pytest_runtest_logfinish (self , nodeid , location ):
104
+ self .sendevent ("logfinish" , nodeid = nodeid , location = location )
109
105
110
106
def pytest_runtest_logreport (self , report ):
111
107
data = self .config .hook .pytest_report_to_serializable (
@@ -125,29 +121,14 @@ def pytest_collectreport(self, report):
125
121
)
126
122
self .sendevent ("collectreport" , data = data )
127
123
128
- # the pytest_warning_recorded hook was introduced in pytest 6.0
129
- if hasattr (_pytest .hookspec , "pytest_warning_recorded" ):
130
-
131
- def pytest_warning_recorded (self , warning_message , when , nodeid , location ):
132
- self .sendevent (
133
- "warning_recorded" ,
134
- warning_message_data = serialize_warning_message (warning_message ),
135
- when = when ,
136
- nodeid = nodeid ,
137
- location = location ,
138
- )
139
-
140
- # the pytest_warning_captured hook was introduced in pytest 3.8
141
- elif hasattr (_pytest .hookspec , "pytest_warning_captured" ):
142
-
143
- def pytest_warning_captured (self , warning_message , when , item ):
144
- self .sendevent (
145
- "warning_captured" ,
146
- warning_message_data = serialize_warning_message (warning_message ),
147
- when = when ,
148
- # item cannot be serialized and will always be None when used with xdist
149
- item = None ,
150
- )
124
+ def pytest_warning_recorded (self , warning_message , when , nodeid , location ):
125
+ self .sendevent (
126
+ "warning_recorded" ,
127
+ warning_message_data = serialize_warning_message (warning_message ),
128
+ when = when ,
129
+ nodeid = nodeid ,
130
+ location = location ,
131
+ )
151
132
152
133
153
134
def serialize_warning_message (warning_message ):
0 commit comments