Mon, 16 May 2022 17:22:43 +0200
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
# -*- coding: utf-8 -*- # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the test runner script for the 'pytest' framework. """ import json import sys # TODO: implement 'pytest' support in PytestRunner class GetPluginVersionsPlugin(): """ Class implementing a pytest plugin to extract the version info of all installed plugins. """ def __init__(self): """ Constructor """ super().__init__() self.versions = [] def pytest_cmdline_main(self, config): """ Public method called for performing the main command line action. @param config pytest config object @type Config """ pluginInfo = config.pluginmanager.list_plugin_distinfo() if pluginInfo: for _plugin, dist in pluginInfo: self.versions.append({ "name": dist.project_name, "version": dist.version }) def getVersions(self): """ Public method to get the assembled list of plugin versions. @return list of collected plugin versions @rtype list of dict """ return self.versions def getVersions(): """ Function to determine the framework version and versions of all available plugins. """ try: import pytest # __IGNORE_WARNING__ versions = { "name": "pytest", "version": pytest.__version__, "plugins": [], } # --capture=sys needed on Windows to avoid # ValueError: saved filedescriptor not valid anymore plugin = GetPluginVersionsPlugin() pytest.main(['--version', '--capture=sys'], plugins=[plugin]) versions["plugins"] = plugin.getVersions() except ImportError: versions = {} print(json.dumps(versions)) sys.exit(0) if __name__ == '__main__': command = sys.argv[1] if command == "installed": try: import pytest # __IGNORE_WARNING__ sys.exit(0) except ImportError: sys.exit(1) elif command == "versions": getVersions() sys.exit(42) # # eflag: noqa = M801