eric7/Unittest/Interfaces/PytestRunner.py

branch
unittest
changeset 9066
a219ade50f7c
parent 9065
39405e6eba20
child 9069
938039ea15ca
--- a/eric7/Unittest/Interfaces/PytestRunner.py	Mon May 16 17:22:43 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-# -*- 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

eric ide

mercurial