src/eric7/Testing/Interfaces/PytestRunner.py

branch
eric7-maintenance
changeset 9549
67295777d9fe
parent 9442
906485dcd210
parent 9482
a2bc06a54d9d
child 9654
7328efba128b
equal deleted inserted replaced
9451:24c847222774 9549:67295777d9fe
11 import json 11 import json
12 import os 12 import os
13 import sys 13 import sys
14 import time 14 import time
15 15
16 sys.path.insert(2, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) 16 sys.path.insert(
17 2,
18 os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")),
19 )
20 # three times up is our installation directory
17 21
18 with contextlib.suppress(ImportError): 22 with contextlib.suppress(ImportError):
19 import pytest 23 import pytest
20 24
21 25
299 """ 303 """
300 Function to determine the framework version and versions of all available 304 Function to determine the framework version and versions of all available
301 plugins. 305 plugins.
302 """ 306 """
303 try: 307 try:
304 import pytest 308 import pytest # __IGNORE_WARNING_I10__
305 309
306 versions = { 310 versions = {
307 "name": "pytest", 311 "name": "pytest",
308 "version": pytest.__version__, 312 "version": pytest.__version__,
309 "plugins": [], 313 "plugins": [],
324 def getMarkers(): 328 def getMarkers():
325 """ 329 """
326 Function to determine the defined markers and their descriptions. 330 Function to determine the defined markers and their descriptions.
327 """ 331 """
328 try: 332 try:
329 import pytest 333 import pytest # __IGNORE_WARNING_I10__
330 334
331 # --capture=sys needed on Windows to avoid 335 # --capture=sys needed on Windows to avoid
332 # ValueError: saved filedescriptor not valid anymore 336 # ValueError: saved filedescriptor not valid anymore
333 plugin = GetMarkersPlugin() 337 plugin = GetMarkersPlugin()
334 pytest.main(["--markers", "--capture=sys"], plugins=[plugin]) 338 pytest.main(["--markers", "--capture=sys"], plugins=[plugin])
354 elif command == "markers": 358 elif command == "markers":
355 getMarkers() 359 getMarkers()
356 360
357 elif command == "runtest": 361 elif command == "runtest":
358 import pytest 362 import pytest
363
359 from eric7.EricNetwork.EricJsonStreamWriter import EricJsonWriter 364 from eric7.EricNetwork.EricJsonStreamWriter import EricJsonWriter
360 365
361 writer = EricJsonWriter(sys.argv[2], int(sys.argv[3])) 366 writer = EricJsonWriter(sys.argv[2], int(sys.argv[3]))
362 pytest.main(sys.argv[4:], plugins=[EricPlugin(writer)]) 367 pytest.main(sys.argv[4:], plugins=[EricPlugin(writer)])
363 writer.close() 368 writer.close()

eric ide

mercurial