src/eric7/Testing/Interfaces/PytestRunner.py

branch
eric7
changeset 11148
15e30f0c76a8
parent 11090
f5f5f5803935
child 11155
e1843b6efa73
equal deleted inserted replaced
11147:dee6e106b4d3 11148:15e30f0c76a8
174 "filename": item.location[0], 174 "filename": item.location[0],
175 "linenumber": item.location[1], 175 "linenumber": item.location[1],
176 } 176 }
177 ) 177 )
178 178
179 def pytest_runtest_logstart(self, nodeid, location): # noqa: U100 179 def pytest_runtest_logstart(self, nodeid, location): # noqa: U-100
180 """ 180 """
181 Public method called by pytest before running a test. 181 Public method called by pytest before running a test.
182 182
183 @param nodeid node id of the test item 183 @param nodeid node id of the test item
184 @type str 184 @type str
266 data["message"] = messageLines[0] 266 data["message"] = messageLines[0]
267 data["report"] = "\n".join(self.__report) 267 data["report"] = "\n".join(self.__report)
268 268
269 self.__writer.write(data) 269 self.__writer.write(data)
270 270
271 def pytest_sessionstart(self, session): # noqa: U100 271 def pytest_sessionstart(self, session): # noqa: U-100
272 """ 272 """
273 Public method called by pytest before performing collection and 273 Public method called by pytest before performing collection and
274 entering the run test loop. 274 entering the run test loop.
275 275
276 @param session reference to the session object (unused) 276 @param session reference to the session object (unused)
277 @type Session 277 @type Session
278 """ 278 """
279 self.__totalStartTime = time.monotonic_ns() 279 self.__totalStartTime = time.monotonic_ns()
280 self.__testsRun = 0 280 self.__testsRun = 0
281 281
282 def pytest_sessionfinish(self, session, exitstatus): # noqa: U100 282 def pytest_sessionfinish(self, session, exitstatus): # noqa: U-100
283 """ 283 """
284 Public method called by pytest after the whole test run finished. 284 Public method called by pytest after the whole test run finished.
285 285
286 @param session reference to the session object (unused) 286 @param session reference to the session object (unused)
287 @type Session 287 @type Session
304 """ 304 """
305 Function to determine the framework version and versions of all available 305 Function to determine the framework version and versions of all available
306 plugins. 306 plugins.
307 """ 307 """
308 try: 308 try:
309 import pytest # __IGNORE_WARNING_I10__ 309 import pytest # __IGNORE_WARNING_I-10__
310 310
311 versions = { 311 versions = {
312 "name": "pytest", 312 "name": "pytest",
313 "version": pytest.__version__, 313 "version": pytest.__version__,
314 "plugins": [], 314 "plugins": [],
329 def getMarkers(): 329 def getMarkers():
330 """ 330 """
331 Function to determine the defined markers and their descriptions. 331 Function to determine the defined markers and their descriptions.
332 """ 332 """
333 try: 333 try:
334 import pytest # __IGNORE_WARNING_I10__ 334 import pytest # __IGNORE_WARNING_I-10__
335 335
336 # --capture=sys needed on Windows to avoid 336 # --capture=sys needed on Windows to avoid
337 # ValueError: saved filedescriptor not valid anymore 337 # ValueError: saved filedescriptor not valid anymore
338 plugin = GetMarkersPlugin() 338 plugin = GetMarkersPlugin()
339 pytest.main(["--markers", "--capture=sys"], plugins=[plugin]) 339 pytest.main(["--markers", "--capture=sys"], plugins=[plugin])
368 sys.exit(0) 368 sys.exit(0)
369 369
370 sys.exit(42) 370 sys.exit(42)
371 371
372 # 372 #
373 # eflag: noqa = M801 373 # eflag: noqa = M-801

eric ide

mercurial