Mon, 16 May 2022 19:46:51 +0200
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
# -*- coding: utf-8 -*- # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the executor for the 'pytest' framework. """ import contextlib import json import os from PyQt6.QtCore import QProcess from .TestExecutorBase import TestExecutorBase # TODO: implement 'pytest' support in PytestExecutor class PytestExecutor(TestExecutorBase): """ Class implementing the executor for the 'pytest' framework. """ module = "pytest" name = "pytest" runner = os.path.join(os.path.dirname(__file__), "PytestRunner.py") def getVersions(self, interpreter): """ Public method to get the test framework version and version information of its installed plugins. @param interpreter interpreter to be used for the test @type str @return dictionary containing the framework name and version and the list of available plugins with name and version each @rtype dict """ proc = QProcess() proc.start(interpreter, [PytestExecutor.runner, "versions"]) if proc.waitForFinished(3000): exitCode = proc.exitCode() if exitCode == 0: outputLines = self.readAllOutput(proc).splitlines() for line in outputLines: if line.startswith("{") and line.endswith("}"): with contextlib.suppress(json.JSONDecodeError): return json.loads(line) return {}