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