Thu, 12 May 2022 08:59:13 +0200
Implemented the basic functionality of the new unit test framework.
# -*- coding: utf-8 -*- # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the executor for the standard 'unittest' framework. """ import contextlib import json import os from PyQt6.QtCore import QProcess from .UTExecutorBase import UTExecutorBase class UnittestExecutor(UTExecutorBase): """ Class implementing the executor for the standard 'unittest' framework. """ module = "unittest" name = "unittest" runner = os.path.join(os.path.dirname(__file__), "UnittestRunner.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, [UnittestExecutor.runner, "versions"]) if proc.waitForFinished(3000): exitCode = proc.exitCode() if exitCode == 0: versionsStr = self.readAllOutput(proc) with contextlib.suppress(json.JSONDecodeError): return json.loads(versionsStr) return {} def createArguments(self, config): """ Public method to create the arguments needed to start the test process. @param config configuration for the test execution @type UTTestConfig @return list of process arguments @rtype list of str @exception NotImplementedError this method needs to be implemented by derived classes """ raise NotImplementedError return []