baldertest 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _balder/__init__.py +12 -0
- _balder/_version.py +34 -0
- _balder/balder_plugin.py +73 -0
- _balder/balder_session.py +341 -0
- _balder/balder_settings.py +15 -0
- _balder/cnnrelations/__init__.py +7 -0
- _balder/cnnrelations/and_connection_relation.py +176 -0
- _balder/cnnrelations/base_connection_relation.py +270 -0
- _balder/cnnrelations/or_connection_relation.py +65 -0
- _balder/collector.py +874 -0
- _balder/connection.py +863 -0
- _balder/connection_metadata.py +255 -0
- _balder/console/__init__.py +0 -0
- _balder/console/balder.py +58 -0
- _balder/controllers/__init__.py +12 -0
- _balder/controllers/base_device_controller.py +72 -0
- _balder/controllers/controller.py +29 -0
- _balder/controllers/device_controller.py +446 -0
- _balder/controllers/feature_controller.py +715 -0
- _balder/controllers/normal_scenario_setup_controller.py +402 -0
- _balder/controllers/scenario_controller.py +524 -0
- _balder/controllers/setup_controller.py +134 -0
- _balder/controllers/vdevice_controller.py +95 -0
- _balder/decorator_connect.py +104 -0
- _balder/decorator_covered_by.py +74 -0
- _balder/decorator_fixture.py +29 -0
- _balder/decorator_for_vdevice.py +118 -0
- _balder/decorator_gateway.py +34 -0
- _balder/decorator_insert_into_tree.py +52 -0
- _balder/decorator_parametrize.py +31 -0
- _balder/decorator_parametrize_by_feature.py +36 -0
- _balder/device.py +18 -0
- _balder/exceptions.py +182 -0
- _balder/executor/__init__.py +0 -0
- _balder/executor/basic_executable_executor.py +133 -0
- _balder/executor/basic_executor.py +205 -0
- _balder/executor/executor_tree.py +217 -0
- _balder/executor/parametrized_testcase_executor.py +52 -0
- _balder/executor/scenario_executor.py +169 -0
- _balder/executor/setup_executor.py +163 -0
- _balder/executor/testcase_executor.py +203 -0
- _balder/executor/unresolved_parametrized_testcase_executor.py +184 -0
- _balder/executor/variation_executor.py +882 -0
- _balder/exit_code.py +19 -0
- _balder/feature.py +74 -0
- _balder/feature_replacement_mapping.py +107 -0
- _balder/feature_vdevice_mapping.py +88 -0
- _balder/fixture_definition_scope.py +19 -0
- _balder/fixture_execution_level.py +22 -0
- _balder/fixture_manager.py +483 -0
- _balder/fixture_metadata.py +26 -0
- _balder/node_gateway.py +103 -0
- _balder/objects/__init__.py +0 -0
- _balder/objects/connections/__init__.py +0 -0
- _balder/objects/connections/osi_1_physical.py +116 -0
- _balder/objects/connections/osi_2_datalink.py +35 -0
- _balder/objects/connections/osi_3_network.py +47 -0
- _balder/objects/connections/osi_4_transport.py +40 -0
- _balder/objects/connections/osi_5_session.py +13 -0
- _balder/objects/connections/osi_6_presentation.py +13 -0
- _balder/objects/connections/osi_7_application.py +83 -0
- _balder/objects/devices/__init__.py +0 -0
- _balder/objects/devices/this_device.py +12 -0
- _balder/parametrization.py +75 -0
- _balder/plugin_manager.py +138 -0
- _balder/previous_executor_mark.py +23 -0
- _balder/routing_path.py +335 -0
- _balder/scenario.py +20 -0
- _balder/setup.py +18 -0
- _balder/solver.py +246 -0
- _balder/testresult.py +163 -0
- _balder/unmapped_vdevice.py +13 -0
- _balder/utils/__init__.py +0 -0
- _balder/utils/functions.py +103 -0
- _balder/utils/inner_device_managing_metaclass.py +14 -0
- _balder/utils/mixin_can_be_covered_by_executor.py +24 -0
- _balder/utils/typings.py +4 -0
- _balder/vdevice.py +9 -0
- balder/__init__.py +56 -0
- balder/connections.py +43 -0
- balder/devices.py +9 -0
- balder/exceptions.py +44 -0
- balder/parametrization.py +8 -0
- baldertest-0.1.0.dist-info/METADATA +356 -0
- baldertest-0.1.0.dist-info/RECORD +89 -0
- baldertest-0.1.0.dist-info/WHEEL +5 -0
- baldertest-0.1.0.dist-info/entry_points.txt +2 -0
- baldertest-0.1.0.dist-info/licenses/LICENSE +21 -0
- baldertest-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@insert_into_tree(parents=[])
|
|
8
|
+
class BluetoothConnection(Connection):
|
|
9
|
+
"""
|
|
10
|
+
Balder Bluetooth connection (OSI LAYER 1)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@insert_into_tree(parents=[])
|
|
15
|
+
class CanBusConnection(Connection):
|
|
16
|
+
"""
|
|
17
|
+
Balder CAN-Bus connection (OSI LAYER 1)
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@insert_into_tree(parents=[])
|
|
22
|
+
class CoaxialCableConnection(Connection):
|
|
23
|
+
"""
|
|
24
|
+
Balder Coaxial-Cable connection (OSI LAYER 1)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@insert_into_tree(parents=[])
|
|
29
|
+
class DslConnection(Connection):
|
|
30
|
+
"""
|
|
31
|
+
Balder DSL connection (OSI LAYER 1)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@insert_into_tree(parents=[])
|
|
36
|
+
class RS232Connection(Connection):
|
|
37
|
+
"""
|
|
38
|
+
Balder RS232 connection (OSI LAYER 1)
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@insert_into_tree(parents=[])
|
|
43
|
+
class RS422Connection(Connection):
|
|
44
|
+
"""
|
|
45
|
+
Balder RS422 connection (OSI LAYER 1)
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@insert_into_tree(parents=[])
|
|
50
|
+
class RS485Connection(Connection):
|
|
51
|
+
"""
|
|
52
|
+
Balder RS485 connection (OSI LAYER 1)
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@insert_into_tree(parents=[])
|
|
57
|
+
class IsdnConnection(Connection):
|
|
58
|
+
"""
|
|
59
|
+
Balder ISDN connection (OSI LAYER 1)
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@insert_into_tree(parents=[])
|
|
64
|
+
class I2CConnection(Connection):
|
|
65
|
+
"""
|
|
66
|
+
Balder I2C connection (OSI LAYER 1)
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@insert_into_tree(parents=[])
|
|
71
|
+
class I2SConnection(Connection):
|
|
72
|
+
"""
|
|
73
|
+
Balder I2S connection (OSI LAYER 1)
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@insert_into_tree(parents=[])
|
|
78
|
+
class OneWireConnection(Connection):
|
|
79
|
+
"""
|
|
80
|
+
Balder One-Wire connection (OSI LAYER 1)
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@insert_into_tree(parents=[])
|
|
85
|
+
class OpticalFiberConnection(Connection):
|
|
86
|
+
"""
|
|
87
|
+
Balder Optical-Fiber connection (OSI LAYER 1)
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@insert_into_tree(parents=[])
|
|
92
|
+
class SpiConnection(Connection):
|
|
93
|
+
"""
|
|
94
|
+
Balder SPI connection (OSI LAYER 1)
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@insert_into_tree(parents=[])
|
|
99
|
+
class TwistedPairCableConnection(Connection):
|
|
100
|
+
"""
|
|
101
|
+
Balder Twisted-Pair Cable connection (OSI LAYER 1)
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@insert_into_tree(parents=[])
|
|
106
|
+
class UsbConnection(Connection):
|
|
107
|
+
"""
|
|
108
|
+
Balder USB connection (OSI LAYER 1)
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@insert_into_tree(parents=[])
|
|
113
|
+
class WifiConnection(Connection):
|
|
114
|
+
"""
|
|
115
|
+
Balder Wi-Fi connection (OSI LAYER 1)
|
|
116
|
+
"""
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_1_physical
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_1_physical.OpticalFiberConnection, osi_1_physical.DslConnection,
|
|
10
|
+
osi_1_physical.IsdnConnection])
|
|
11
|
+
class EthernetConnection(Connection):
|
|
12
|
+
"""
|
|
13
|
+
Balder Ethernet connection (OSI LAYER 2)
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@insert_into_tree(parents=[osi_1_physical.WifiConnection])
|
|
18
|
+
class WirelessLanConnection(Connection):
|
|
19
|
+
"""
|
|
20
|
+
Balder Wireless LAN connection (OSI LAYER 2)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@insert_into_tree(parents=[])
|
|
25
|
+
class LLDPConnection(Connection):
|
|
26
|
+
"""
|
|
27
|
+
Balder LLDP connection (OSI LAYER 2)
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@insert_into_tree(parents=[])
|
|
32
|
+
class ProfibusConnection(Connection):
|
|
33
|
+
"""
|
|
34
|
+
Balder Profibus connection (OSI LAYER 2)
|
|
35
|
+
"""
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_2_datalink
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_2_datalink.EthernetConnection, osi_2_datalink.WirelessLanConnection])
|
|
10
|
+
class IPv4Connection(Connection):
|
|
11
|
+
"""
|
|
12
|
+
Balder IPv4 connection (OSI LAYER 3)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@insert_into_tree(parents=[osi_2_datalink.EthernetConnection, osi_2_datalink.WirelessLanConnection])
|
|
17
|
+
class IPv6Connection(Connection):
|
|
18
|
+
"""
|
|
19
|
+
Balder IPv6 connection (OSI LAYER 3)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
IPConnection = Connection.based_on(IPv4Connection | IPv6Connection)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@insert_into_tree(parents=[IPv4Connection, IPv6Connection])
|
|
27
|
+
class IpSecConnection(Connection):
|
|
28
|
+
"""
|
|
29
|
+
Balder IPSec connection (OSI LAYER 3)
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@insert_into_tree(parents=[IPv4Connection])
|
|
34
|
+
class ICMPv4Connection(Connection):
|
|
35
|
+
"""
|
|
36
|
+
Balder ICMP IPv4 connection (OSI LAYER 3)
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@insert_into_tree(parents=[IPv6Connection])
|
|
41
|
+
class ICMPv6Connection(Connection):
|
|
42
|
+
"""
|
|
43
|
+
Balder ICMP IPv6 connection (OSI LAYER 3)
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
ICMPConnection = Connection.based_on(ICMPv4Connection | ICMPv6Connection)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_3_network
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_3_network.IPv4Connection])
|
|
10
|
+
class TcpIPv4Connection(Connection):
|
|
11
|
+
"""
|
|
12
|
+
Balder TCP IPv4 connection (OSI LAYER 4)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@insert_into_tree(parents=[osi_3_network.IPv6Connection])
|
|
17
|
+
class TcpIPv6Connection(Connection):
|
|
18
|
+
"""
|
|
19
|
+
Balder TCP IPv6 connection (OSI LAYER 4)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
TcpConnection = Connection.based_on(TcpIPv4Connection | TcpIPv6Connection)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@insert_into_tree(parents=[osi_3_network.IPv4Connection])
|
|
27
|
+
class UdpIPv4Connection(Connection):
|
|
28
|
+
"""
|
|
29
|
+
Balder UDP IPv4 connection (OSI LAYER 4)
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@insert_into_tree(parents=[osi_3_network.IPv6Connection])
|
|
34
|
+
class UdpIPv6Connection(Connection):
|
|
35
|
+
"""
|
|
36
|
+
Balder UDP IPv6 connection (OSI LAYER 4)
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
UdpConnection = Connection.based_on(UdpIPv4Connection | UdpIPv6Connection)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_4_transport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
10
|
+
class PptpConnection(Connection):
|
|
11
|
+
"""
|
|
12
|
+
Balder PPTP connection (OSI LAYER 5)
|
|
13
|
+
"""
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_4_transport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
10
|
+
class TelnetConnection(Connection):
|
|
11
|
+
"""
|
|
12
|
+
Balder TELNET connection (OSI LAYER 6)
|
|
13
|
+
"""
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.connection import Connection
|
|
4
|
+
from _balder.decorator_insert_into_tree import insert_into_tree
|
|
5
|
+
|
|
6
|
+
from _balder.objects.connections import osi_3_network, osi_4_transport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
10
|
+
class HttpConnection(Connection):
|
|
11
|
+
"""
|
|
12
|
+
Balder HTTP connection (OSI LAYER 7)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
17
|
+
class ImapConnection(Connection):
|
|
18
|
+
"""
|
|
19
|
+
Balder IMAP connection (OSI LAYER 7)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@insert_into_tree(
|
|
24
|
+
parents=[
|
|
25
|
+
(osi_4_transport.TcpIPv4Connection, osi_4_transport.UdpIPv4Connection),
|
|
26
|
+
(osi_4_transport.TcpIPv6Connection, osi_4_transport.UdpIPv6Connection),
|
|
27
|
+
osi_3_network.IPv4Connection,
|
|
28
|
+
osi_3_network.IPv6Connection
|
|
29
|
+
])
|
|
30
|
+
class LdapConnection(Connection):
|
|
31
|
+
"""
|
|
32
|
+
Balder LDAP connection (OSI LAYER 7)
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@insert_into_tree(parents=[osi_4_transport.UdpIPv4Connection, osi_4_transport.UdpIPv6Connection])
|
|
37
|
+
class NtpConnection(Connection):
|
|
38
|
+
"""
|
|
39
|
+
Balder NTP connection (OSI LAYER 7)
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@insert_into_tree(
|
|
44
|
+
parents=[
|
|
45
|
+
(osi_4_transport.UdpIPv4Connection, osi_4_transport.TcpIPv4Connection),
|
|
46
|
+
(osi_4_transport.UdpIPv6Connection, osi_4_transport.TcpIPv6Connection)
|
|
47
|
+
])
|
|
48
|
+
class RpcConnection(Connection):
|
|
49
|
+
"""
|
|
50
|
+
Balder RPC connection (OSI LAYER 7)
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
55
|
+
class SmtpConnection(Connection):
|
|
56
|
+
"""
|
|
57
|
+
Balder SMTP connection (OSI LAYER 7)
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@insert_into_tree(parents=[osi_4_transport.UdpIPv4Connection, osi_4_transport.UdpIPv6Connection])
|
|
62
|
+
class SntpConnection(Connection):
|
|
63
|
+
"""
|
|
64
|
+
Balder SNTP connection (OSI LAYER 7)
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@insert_into_tree(parents=[osi_4_transport.TcpIPv4Connection, osi_4_transport.TcpIPv6Connection])
|
|
69
|
+
class SshConnection(Connection):
|
|
70
|
+
"""
|
|
71
|
+
Balder SSH connection (OSI LAYER 7)
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@insert_into_tree(
|
|
76
|
+
parents=[
|
|
77
|
+
(osi_4_transport.UdpIPv4Connection, osi_4_transport.TcpIPv4Connection),
|
|
78
|
+
(osi_4_transport.UdpIPv6Connection, osi_4_transport.TcpIPv6Connection)
|
|
79
|
+
])
|
|
80
|
+
class DnsConnection(Connection):
|
|
81
|
+
"""
|
|
82
|
+
Balder DNS connection (OSI LAYER 7)
|
|
83
|
+
"""
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from _balder.device import Device
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ThisDevice(Device):
|
|
7
|
+
"""
|
|
8
|
+
This class describes the test computer on which this code is currently being executed. It represents an abstract
|
|
9
|
+
class that must not be used directly. Rather, it serves as the large superclass over all Balder objects.
|
|
10
|
+
|
|
11
|
+
Note that this is the parent class for the :class:`Setup` inner class :class:`Setup.DeviceThis`.
|
|
12
|
+
"""
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import Type, Dict, Any, TypeVar, List
|
|
3
|
+
import dataclasses
|
|
4
|
+
|
|
5
|
+
from _balder.device import Device
|
|
6
|
+
|
|
7
|
+
ValueTypeT = TypeVar("ValueTypeT")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclasses.dataclass
|
|
11
|
+
class FeatureAccessSelector:
|
|
12
|
+
"""helper object for dynamic parametrizing by feature method/property"""
|
|
13
|
+
device: Type[Device]
|
|
14
|
+
device_property_name: str
|
|
15
|
+
feature_property_name: str
|
|
16
|
+
parameters: Dict[str, FeatureAccessSelector | Value] = dataclasses.field(default_factory=dict)
|
|
17
|
+
|
|
18
|
+
def get_value(self, available_parameters: Dict[str, Any]) -> List[Any]:
|
|
19
|
+
"""accesses the configured method/property"""
|
|
20
|
+
resolved_parameters = {}
|
|
21
|
+
for cur_key, cur_value in self.parameters.items():
|
|
22
|
+
if isinstance(cur_value, FeatureAccessSelector):
|
|
23
|
+
resolved_parameters[cur_key] = cur_value.get_value(available_parameters)
|
|
24
|
+
elif isinstance(cur_value, Parameter):
|
|
25
|
+
resolved_parameters[cur_key] = available_parameters[cur_value.name]
|
|
26
|
+
elif isinstance(cur_value, Value):
|
|
27
|
+
resolved_parameters[cur_key] = cur_value.value
|
|
28
|
+
else:
|
|
29
|
+
raise TypeError(f'go unexpected parameter type {type(cur_value)} in FeatureAccessSelector')
|
|
30
|
+
|
|
31
|
+
feature = getattr(self.device, self.device_property_name)
|
|
32
|
+
|
|
33
|
+
if isinstance(getattr(feature.__class__, self.feature_property_name), property):
|
|
34
|
+
return getattr(feature, self.feature_property_name)
|
|
35
|
+
|
|
36
|
+
return getattr(feature, self.feature_property_name)(**resolved_parameters)
|
|
37
|
+
|
|
38
|
+
def get_parameters(
|
|
39
|
+
self,
|
|
40
|
+
of_type: Type[FeatureAccessSelector | Parameter | Value] | None = None
|
|
41
|
+
) -> Dict[str, FeatureAccessSelector | Parameter | Value]:
|
|
42
|
+
"""
|
|
43
|
+
Returns the parameters of this access selector
|
|
44
|
+
|
|
45
|
+
:param of_type: allows to filter the parameters by the value's type
|
|
46
|
+
"""
|
|
47
|
+
result = {}
|
|
48
|
+
for cur_attr, cur_value in self.parameters.items():
|
|
49
|
+
if of_type is None or isinstance(cur_value, of_type):
|
|
50
|
+
result[cur_attr] = cur_value
|
|
51
|
+
return result
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Parameter:
|
|
55
|
+
"""allows to parametrize a parametrization by another parametrization value"""
|
|
56
|
+
|
|
57
|
+
def __init__(self, name: str) -> None:
|
|
58
|
+
self._name = name
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def name(self) -> str:
|
|
62
|
+
"""returns the name of the parameter"""
|
|
63
|
+
return self._name
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Value:
|
|
67
|
+
"""allows to parametrize a parametrization by a fix value"""
|
|
68
|
+
|
|
69
|
+
def __init__(self, value: ValueTypeT) -> None:
|
|
70
|
+
self._value = value
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def value(self) -> ValueTypeT:
|
|
74
|
+
"""returns the value of the parametrization"""
|
|
75
|
+
return self._value
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING, List, Type, Tuple, Union
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import pathlib
|
|
6
|
+
from _balder.balder_plugin import BalderPlugin
|
|
7
|
+
from _balder.exceptions import UnexpectedPluginMethodReturnValue
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from _balder.balder_session import BalderSession
|
|
11
|
+
from _balder.executor.executor_tree import ExecutorTree
|
|
12
|
+
from _balder.scenario import Scenario
|
|
13
|
+
from _balder.setup import Setup
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PluginManager:
|
|
17
|
+
"""
|
|
18
|
+
This class is a helper class that manages all existing plugins.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self):
|
|
22
|
+
self.all_plugins: List[BalderPlugin] = []
|
|
23
|
+
|
|
24
|
+
def register(self, plugin_class: Type[BalderPlugin], session: BalderSession):
|
|
25
|
+
"""
|
|
26
|
+
This method registers a new plugin class.
|
|
27
|
+
|
|
28
|
+
:param plugin_class: the new class that should be registered
|
|
29
|
+
|
|
30
|
+
:param session: the balder session, the new plugin belongs to
|
|
31
|
+
"""
|
|
32
|
+
if plugin_class in [cur_plugin_instance.__class__ for cur_plugin_instance in self.all_plugins]:
|
|
33
|
+
raise ValueError(f"the given plugin class `{plugin_class.__name__}` can not be added twice")
|
|
34
|
+
plugin_instance = plugin_class(session)
|
|
35
|
+
self.all_plugins.append(plugin_instance)
|
|
36
|
+
|
|
37
|
+
def execute_addoption(self, argument_parser: argparse.ArgumentParser) -> None:
|
|
38
|
+
"""
|
|
39
|
+
This method executes all plugin callbacks :ref:`BalderPlugin.addoption`.
|
|
40
|
+
|
|
41
|
+
The callback will be executed while the `ArgumentParser` is being created.
|
|
42
|
+
|
|
43
|
+
:param argument_parser: the argument parser object
|
|
44
|
+
"""
|
|
45
|
+
for cur_plugin in self.all_plugins:
|
|
46
|
+
cur_plugin.addoption(argument_parser)
|
|
47
|
+
|
|
48
|
+
def execute_modify_collected_pyfiles(self, pyfiles: List[pathlib.Path]) -> List[pathlib.Path]:
|
|
49
|
+
"""
|
|
50
|
+
This method executes all plugin callbacks :ref:`BalderPlugin.cb_filter_executor_tree`.
|
|
51
|
+
|
|
52
|
+
The callback will be executed to filter the collected pyfiles, that will be analysed later. From these files,
|
|
53
|
+
balder tries to determine and then import relevant :class:`Scenario` and :class:`Setup` classes later.
|
|
54
|
+
|
|
55
|
+
:param pyfiles: a list with all collected pyfiles
|
|
56
|
+
|
|
57
|
+
:return: the new list that should be used for the pyfiles
|
|
58
|
+
"""
|
|
59
|
+
cur_pyfiles = pyfiles
|
|
60
|
+
for cur_plugin in self.all_plugins:
|
|
61
|
+
if cur_plugin.__class__.modify_collected_pyfiles == BalderPlugin.modify_collected_pyfiles:
|
|
62
|
+
# there is no specific implementation
|
|
63
|
+
break
|
|
64
|
+
ret = cur_plugin.modify_collected_pyfiles(pyfiles=cur_pyfiles)
|
|
65
|
+
if ret is None:
|
|
66
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
67
|
+
f"the method `modify_collected_pyfiles` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
68
|
+
f"returned something - a list of filepaths was expected")
|
|
69
|
+
if not isinstance(ret, list):
|
|
70
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
71
|
+
f"the method `modify_collected_pyfiles` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
72
|
+
f"returned a list (return type is `{type(ret)}`)")
|
|
73
|
+
cur_pyfiles = ret
|
|
74
|
+
return cur_pyfiles
|
|
75
|
+
|
|
76
|
+
def execute_collected_classes(self, scenarios: List[Type[Scenario]], setups: List[Type[Setup]]) \
|
|
77
|
+
-> Tuple[List[Type[Scenario]], List[Type[Setup]]]:
|
|
78
|
+
"""
|
|
79
|
+
This method executes all plugin callbacks :ref:`BalderPlugin.cb_filter_executor_tree`.
|
|
80
|
+
|
|
81
|
+
The callback will be executed to filter the collected :class:`Scenario` and :class:`Setup` classes.
|
|
82
|
+
|
|
83
|
+
:param scenarios: a list with all collected :class:`Scenario` classes before the plugin can filter it
|
|
84
|
+
|
|
85
|
+
:param setups: a list with all collected :class:`Setup` classes before the plugin can filter it
|
|
86
|
+
|
|
87
|
+
:return: a tuple where the first element is the new :class:`Scenario` list and the second is the new
|
|
88
|
+
:class:`Setup` class list
|
|
89
|
+
"""
|
|
90
|
+
cur_scenarios = scenarios
|
|
91
|
+
cur_setups = setups
|
|
92
|
+
for cur_plugin in self.all_plugins:
|
|
93
|
+
if cur_plugin.__class__.modify_collected_classes == BalderPlugin.modify_collected_classes:
|
|
94
|
+
# there is no specific implementation
|
|
95
|
+
break
|
|
96
|
+
ret = cur_plugin.modify_collected_classes(scenarios=cur_scenarios, setups=cur_setups)
|
|
97
|
+
if ret is None:
|
|
98
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
99
|
+
f"the method `execute_collected_classes` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
100
|
+
f"returned something - a tuple with two lists for Scenarios and Setups was expected")
|
|
101
|
+
if not isinstance(ret, tuple):
|
|
102
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
103
|
+
f"the method `execute_collected_classes` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
104
|
+
f"returned a tuple (return type is `{type(ret)}`)")
|
|
105
|
+
if not len(ret) == 2:
|
|
106
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
107
|
+
f"the method `execute_collected_classes` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
108
|
+
f"returned a tuple of length 2")
|
|
109
|
+
if not isinstance(ret[0], list) or not isinstance(ret[1], list):
|
|
110
|
+
raise UnexpectedPluginMethodReturnValue(
|
|
111
|
+
f"the method `execute_collected_classes` of balder plugin `{cur_plugin.__class__.__name__}` has not"
|
|
112
|
+
f"returned a tuple with two lists as values")
|
|
113
|
+
cur_scenarios, cur_setups = ret
|
|
114
|
+
return cur_scenarios, cur_setups
|
|
115
|
+
|
|
116
|
+
def execute_filter_executor_tree(self, executor_tree: ExecutorTree) -> None:
|
|
117
|
+
"""
|
|
118
|
+
This method executes all plugin methods :ref:`BalderPlugin.filter_executor_tree`.
|
|
119
|
+
|
|
120
|
+
The callback will be executed to filter the created :class:`ExecutorTree` for this balder session. For this the
|
|
121
|
+
:class:`ExecutorTree` reference (given by ``executor_tree``) can be manipulated.
|
|
122
|
+
|
|
123
|
+
:param executor_tree: the reference to the main :class:`ExecutorTree` object that balder uses for this session
|
|
124
|
+
"""
|
|
125
|
+
for cur_plugin in self.all_plugins:
|
|
126
|
+
cur_plugin.filter_executor_tree(executor_tree=executor_tree)
|
|
127
|
+
|
|
128
|
+
def execute_session_finished(self, executor_tree: Union[ExecutorTree, None]) -> None:
|
|
129
|
+
"""
|
|
130
|
+
This method executes all plugin methods :ref:`BalderPlugin.session_finished`.
|
|
131
|
+
|
|
132
|
+
This callback will be executed at the end of every session. The callback will run in a `collect-only` and
|
|
133
|
+
`resolve-only` session too. Note, that the `executor_tree` argument is None in a `collect-only` session.
|
|
134
|
+
|
|
135
|
+
:param executor_tree: the reference to the main :class:`ExecutorTree` object that balder uses for this session
|
|
136
|
+
"""
|
|
137
|
+
for cur_plugin in self.all_plugins:
|
|
138
|
+
cur_plugin.session_finished(executor_tree=executor_tree)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PreviousExecutorMark(Enum):
|
|
6
|
+
"""
|
|
7
|
+
This enum defines the previous state of an executor object. It allows to set a pre-state to an executor, that
|
|
8
|
+
describes if it is executable before the executor-tree will be called
|
|
9
|
+
"""
|
|
10
|
+
#: this is the normal state, where all sub elements are allowed to be executed
|
|
11
|
+
RUNNABLE = 1
|
|
12
|
+
|
|
13
|
+
#: this marks the element and all of its sub elements as skip-able
|
|
14
|
+
SKIP = 2
|
|
15
|
+
|
|
16
|
+
#: this marks the element and all of its sub elements as NOT RUNNABLE, because this element is covered_by another
|
|
17
|
+
COVERED_BY = 3
|
|
18
|
+
|
|
19
|
+
#: this marks that the element should be ignored from the executor mechanism
|
|
20
|
+
IGNORE = -1
|
|
21
|
+
|
|
22
|
+
#: this marks that the element was already discarded because its variation is not applicable
|
|
23
|
+
DISCARDED = -2
|