132 self.__sections = [] |
132 self.__sections = [] |
133 self.__hadError = False |
133 self.__hadError = False |
134 self.__wasSkipped = False |
134 self.__wasSkipped = False |
135 self.__wasXfail = False |
135 self.__wasXfail = False |
136 |
136 |
137 def pytest_report_header(self, config, _startdir): |
137 def pytest_report_header(self, config): |
138 """ |
138 """ |
139 Public method called by pytest before any reporting. |
139 Public method called by pytest before any reporting. |
140 |
140 |
141 @param config reference to the configuration object |
141 @param config reference to the configuration object |
142 @type Config |
142 @type Config |
143 @param _startdir starting directory (unused) |
|
144 @type LocalPath |
|
145 """ |
143 """ |
146 self.__writer.write({"event": "config", "root": str(config.rootdir)}) |
144 self.__writer.write({"event": "config", "root": str(config.rootdir)}) |
147 |
145 |
148 def pytest_collectreport(self, report): |
146 def pytest_collectreport(self, report): |
149 """ |
147 """ |
176 "filename": item.location[0], |
174 "filename": item.location[0], |
177 "linenumber": item.location[1], |
175 "linenumber": item.location[1], |
178 } |
176 } |
179 ) |
177 ) |
180 |
178 |
181 def pytest_runtest_logstart(self, nodeid, _location): |
179 def pytest_runtest_logstart(self, nodeid, location): # noqa: U100 |
182 """ |
180 """ |
183 Public method called by pytest before running a test. |
181 Public method called by pytest before running a test. |
184 |
182 |
185 @param nodeid node id of the test item |
183 @param nodeid node id of the test item |
186 @type str |
184 @type str |
187 @param _location tuple containing the file name, the line number and |
185 @param location tuple containing the file name, the line number and |
188 the test name (unused) |
186 the test name (unused) |
189 @type tuple of (str, int, str) |
187 @type tuple of (str, int, str) |
190 """ |
188 """ |
191 self.__testsRun += 1 |
189 self.__testsRun += 1 |
192 |
190 |
268 data["message"] = messageLines[0] |
266 data["message"] = messageLines[0] |
269 data["report"] = "\n".join(self.__report) |
267 data["report"] = "\n".join(self.__report) |
270 |
268 |
271 self.__writer.write(data) |
269 self.__writer.write(data) |
272 |
270 |
273 def pytest_sessionstart(self, _session): |
271 def pytest_sessionstart(self, session): # noqa: U100 |
274 """ |
272 """ |
275 Public method called by pytest before performing collection and |
273 Public method called by pytest before performing collection and |
276 entering the run test loop. |
274 entering the run test loop. |
277 |
275 |
278 @param _session reference to the session object (unused) |
276 @param session reference to the session object (unused) |
279 @type Session |
277 @type Session |
280 """ |
278 """ |
281 self.__totalStartTime = time.monotonic_ns() |
279 self.__totalStartTime = time.monotonic_ns() |
282 self.__testsRun = 0 |
280 self.__testsRun = 0 |
283 |
281 |
284 def pytest_sessionfinish(self, _session, _exitstatus): |
282 def pytest_sessionfinish(self, session, exitstatus): # noqa: U100 |
285 """ |
283 """ |
286 Public method called by pytest after the whole test run finished. |
284 Public method called by pytest after the whole test run finished. |
287 |
285 |
288 @param _session reference to the session object (unused) |
286 @param session reference to the session object (unused) |
289 @type Session |
287 @type Session |
290 @param _exitstatus exit status (unused) |
288 @param exitstatus exit status (unused) |
291 @type int or ExitCode |
289 @type int or ExitCode |
292 """ |
290 """ |
293 stopTime = time.monotonic_ns() |
291 stopTime = time.monotonic_ns() |
294 duration = (stopTime - self.__totalStartTime) / 1_000_000_000 # s |
292 duration = (stopTime - self.__totalStartTime) / 1_000_000_000 # s |
295 |
293 |