src/eric7/Testing/Interfaces/TestFrameworkRegistry.py

branch
eric7-maintenance
changeset 9264
18a7312cfdb3
parent 9192
a763d57e23bc
parent 9221
bf71ee032bb4
child 9654
7328efba128b
equal deleted inserted replaced
9241:d23e9854aea4 9264:18a7312cfdb3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a simple registry containing the available test framework
8 interfaces.
9 """
10
11 import copy
12
13
14 class TestFrameworkRegistry:
15 """
16 Class implementing a simple registry of test framework interfaces.
17
18 The test executor for a framework is responsible for running the tests,
19 receiving the results and preparing them for display. It must implement
20 the interface of TestExecutorBase.
21
22 Frameworks must first be registered using '.register()'. This registry
23 can then create the assoicated test executor when '.createExecutor()' is
24 called.
25 """
26
27 def __init__(self):
28 """
29 Constructor
30 """
31 self.__frameworks = {}
32
33 def register(self, executorClass):
34 """
35 Public method to register a test framework executor.
36
37 @param executorClass class implementing the test framework executor
38 @type TestExecutorBase
39 """
40 self.__frameworks[executorClass.name] = executorClass
41
42 def createExecutor(self, framework, widget):
43 """
44 Public method to create a test framework executor.
45
46 Note: The executor classes have to be registered first.
47
48 @param framework name of the test framework
49 @type str
50 @param widget reference to the unit test widget
51 @type TestingWidget
52 @return test framework executor object
53 @rtype TestExecutorBase
54 """
55 cls = self.__frameworks[framework]
56 return cls(widget)
57
58 def getFrameworks(self):
59 """
60 Public method to get a copy of the registered frameworks.
61
62 @return copy of the registered frameworks
63 @rtype dict
64 """
65 return copy.copy(self.__frameworks)

eric ide

mercurial