py_canoe 3.0.3__py3-none-any.whl → 26.0.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.
Files changed (124) hide show
  1. py_canoe/__init__.py +2 -1
  2. py_canoe/canoe.py +910 -0
  3. py_canoe/core/__init__.py +0 -0
  4. py_canoe/core/application.py +170 -0
  5. py_canoe/core/bus.py +301 -0
  6. py_canoe/core/capl.py +59 -0
  7. py_canoe/core/child_elements/__init__.py +0 -0
  8. py_canoe/core/child_elements/application_model.py +24 -0
  9. py_canoe/core/child_elements/application_model_file.py +21 -0
  10. py_canoe/core/child_elements/application_model_files.py +22 -0
  11. py_canoe/core/child_elements/application_model_setup.py +15 -0
  12. py_canoe/core/child_elements/application_models.py +22 -0
  13. py_canoe/core/child_elements/application_socket.py +11 -0
  14. py_canoe/core/child_elements/application_specific_module.py +24 -0
  15. py_canoe/core/child_elements/application_specific_modules.py +16 -0
  16. py_canoe/core/child_elements/audio_interface.py +28 -0
  17. py_canoe/core/child_elements/available_modules.py +22 -0
  18. py_canoe/core/child_elements/basic_module.py +19 -0
  19. py_canoe/core/child_elements/basic_modules.py +16 -0
  20. py_canoe/core/child_elements/c_libraries.py +28 -0
  21. py_canoe/core/child_elements/c_library.py +33 -0
  22. py_canoe/core/child_elements/can_controller.py +74 -0
  23. py_canoe/core/child_elements/capl_function.py +17 -0
  24. py_canoe/core/child_elements/ccp_setup.py +15 -0
  25. py_canoe/core/child_elements/channel.py +20 -0
  26. py_canoe/core/child_elements/channels.py +19 -0
  27. py_canoe/core/child_elements/communication_setup.py +23 -0
  28. py_canoe/core/child_elements/compile_result.py +22 -0
  29. py_canoe/core/child_elements/configured_channel.py +48 -0
  30. py_canoe/core/child_elements/configured_channels.py +21 -0
  31. py_canoe/core/child_elements/configured_module.py +82 -0
  32. py_canoe/core/child_elements/configured_modules.py +61 -0
  33. py_canoe/core/child_elements/connected_modules.py +14 -0
  34. py_canoe/core/child_elements/data_source.py +42 -0
  35. py_canoe/core/child_elements/data_source_file.py +21 -0
  36. py_canoe/core/child_elements/data_source_files.py +22 -0
  37. py_canoe/core/child_elements/data_source_issue.py +22 -0
  38. py_canoe/core/child_elements/data_source_issues.py +16 -0
  39. py_canoe/core/child_elements/data_source_setup.py +17 -0
  40. py_canoe/core/child_elements/data_sources.py +27 -0
  41. py_canoe/core/child_elements/database_setup.py +62 -0
  42. py_canoe/core/child_elements/device.py +34 -0
  43. py_canoe/core/child_elements/devices.py +13 -0
  44. py_canoe/core/child_elements/diagnostic.py +22 -0
  45. py_canoe/core/child_elements/diagnostic_request.py +59 -0
  46. py_canoe/core/child_elements/diagnostic_response.py +34 -0
  47. py_canoe/core/child_elements/diagnostic_responses.py +13 -0
  48. py_canoe/core/child_elements/diagnostics_setup.py +254 -0
  49. py_canoe/core/child_elements/distributed_mode.py +74 -0
  50. py_canoe/core/child_elements/encoding.py +27 -0
  51. py_canoe/core/child_elements/encodings.py +13 -0
  52. py_canoe/core/child_elements/environment_array.py +13 -0
  53. py_canoe/core/child_elements/environment_group.py +22 -0
  54. py_canoe/core/child_elements/environment_info.py +14 -0
  55. py_canoe/core/child_elements/environment_variable.py +55 -0
  56. py_canoe/core/child_elements/fdx_files.py +50 -0
  57. py_canoe/core/child_elements/file_group_data_source.py +17 -0
  58. py_canoe/core/child_elements/general_setup.py +66 -0
  59. py_canoe/core/child_elements/macros_setup.py +52 -0
  60. py_canoe/core/child_elements/mc_ecus.py +428 -0
  61. py_canoe/core/child_elements/measurement_setup.py +269 -0
  62. py_canoe/core/child_elements/modules.py +87 -0
  63. py_canoe/core/child_elements/most_disassembler.py +21 -0
  64. py_canoe/core/child_elements/most_network_interface.py +4 -0
  65. py_canoe/core/child_elements/namespace.py +21 -0
  66. py_canoe/core/child_elements/namespaces.py +19 -0
  67. py_canoe/core/child_elements/network.py +18 -0
  68. py_canoe/core/child_elements/network_adapters.py +13 -0
  69. py_canoe/core/child_elements/nodes.py +119 -0
  70. py_canoe/core/child_elements/open_configuration_result.py +0 -0
  71. py_canoe/core/child_elements/panel_setup.py +97 -0
  72. py_canoe/core/child_elements/participant.py +17 -0
  73. py_canoe/core/child_elements/participants.py +22 -0
  74. py_canoe/core/child_elements/ports.py +81 -0
  75. py_canoe/core/child_elements/replay_collection.py +56 -0
  76. py_canoe/core/child_elements/security_configuration.py +20 -0
  77. py_canoe/core/child_elements/security_setup.py +31 -0
  78. py_canoe/core/child_elements/signals.py +39 -0
  79. py_canoe/core/child_elements/simulation_setup.py +0 -0
  80. py_canoe/core/child_elements/single_file_data_source.py +13 -0
  81. py_canoe/core/child_elements/snippet_setup.py +68 -0
  82. py_canoe/core/child_elements/standalone_mode.py +0 -0
  83. py_canoe/core/child_elements/start_value_list.py +0 -0
  84. py_canoe/core/child_elements/symbol_mappings.py +0 -0
  85. py_canoe/core/child_elements/tcp_ip_stack_setting.py +0 -0
  86. py_canoe/core/child_elements/test_configurations.py +0 -0
  87. py_canoe/core/child_elements/test_environment.py +64 -0
  88. py_canoe/core/child_elements/test_environments.py +26 -0
  89. py_canoe/core/child_elements/test_module.py +213 -0
  90. py_canoe/core/child_elements/test_modules.py +23 -0
  91. py_canoe/core/child_elements/test_setup.py +16 -0
  92. py_canoe/core/child_elements/test_setup_folder_ext.py +36 -0
  93. py_canoe/core/child_elements/test_setup_folders.py +25 -0
  94. py_canoe/core/child_elements/user_files.py +0 -0
  95. py_canoe/core/child_elements/variable.py +144 -0
  96. py_canoe/core/child_elements/variable_events.py +14 -0
  97. py_canoe/core/child_elements/variables.py +29 -0
  98. py_canoe/core/child_elements/variables_file.py +15 -0
  99. py_canoe/core/child_elements/variables_files.py +19 -0
  100. py_canoe/core/child_elements/visual_sequence_setup.py +46 -0
  101. py_canoe/core/child_elements/vt_system.py +83 -0
  102. py_canoe/core/child_elements/vtt_sut_import_result.py +21 -0
  103. py_canoe/core/child_elements/write.py +71 -0
  104. py_canoe/core/child_elements/xcp_setup.py +12 -0
  105. py_canoe/core/configuration.py +509 -0
  106. py_canoe/core/environment.py +59 -0
  107. py_canoe/core/measurement.py +149 -0
  108. py_canoe/core/networks.py +103 -0
  109. py_canoe/core/performance.py +21 -0
  110. py_canoe/core/simulation.py +53 -0
  111. py_canoe/core/system.py +164 -0
  112. py_canoe/core/ui.py +53 -0
  113. py_canoe/core/version.py +54 -0
  114. py_canoe/helpers/__init__.py +0 -0
  115. py_canoe/helpers/common.py +78 -0
  116. {py_canoe-3.0.3.dist-info → py_canoe-26.0.0.dist-info}/METADATA +331 -327
  117. py_canoe-26.0.0.dist-info/RECORD +118 -0
  118. py_canoe-26.0.0.dist-info/WHEEL +4 -0
  119. py_canoe/logging_collection.py +0 -345
  120. py_canoe/py_canoe.py +0 -2586
  121. py_canoe/py_canoe_logger.py +0 -29
  122. py_canoe-3.0.3.dist-info/LICENSE +0 -21
  123. py_canoe-3.0.3.dist-info/RECORD +0 -8
  124. py_canoe-3.0.3.dist-info/WHEEL +0 -4
@@ -0,0 +1,13 @@
1
+ from py_canoe.core.child_elements.data_source_file import DataSourceFile
2
+
3
+
4
+ class SingleFileDataSource:
5
+ """
6
+ Represents a data source for a single file.
7
+ """
8
+ def __init__(self, com_object) -> None:
9
+ self.com_object = com_object
10
+
11
+ @property
12
+ def file(self) -> 'DataSourceFile':
13
+ return DataSourceFile(self.com_object.File)
@@ -0,0 +1,68 @@
1
+ import win32com.client
2
+
3
+
4
+ class SnippetSetup:
5
+ def __init__(self, com_object):
6
+ self.com_object = com_object
7
+
8
+ @property
9
+ def snippet_files(self) -> 'SnippetFiles':
10
+ return SnippetFiles(self.com_object.SnippetFiles)
11
+
12
+
13
+ class SnippetFiles:
14
+ def __init__(self, com_object):
15
+ self.com_object = com_object
16
+
17
+ @property
18
+ def count(self) -> int:
19
+ return self.com_object.Count
20
+
21
+ def item(self, index: int) -> 'SnippetFile':
22
+ return SnippetFile(self.com_object.Item(index))
23
+
24
+ def add(self, file_name: str, full_name: str) -> 'SnippetFile':
25
+ return SnippetFile(self.com_object.Add(file_name, full_name))
26
+
27
+ def remove(self, index: int):
28
+ self.com_object.Remove(index)
29
+
30
+
31
+ class SnippetFile:
32
+ def __init__(self, com_object):
33
+ self.com_object = win32com.client.Dispatch(com_object)
34
+
35
+ @property
36
+ def full_name(self) -> str:
37
+ return self.com_object.FullName
38
+
39
+ @property
40
+ def snippets(self) -> 'Snippets':
41
+ return self.com_object.Snippets
42
+
43
+
44
+ class Snippets:
45
+ def __init__(self, com_object):
46
+ self.com_object = com_object
47
+
48
+ @property
49
+ def count(self) -> int:
50
+ return self.com_object.Count
51
+
52
+ def item(self, index: int) -> 'Snippet':
53
+ return Snippet(self.com_object.Item(index))
54
+
55
+
56
+ class Snippet:
57
+ def __init__(self, com_object):
58
+ self.com_object = win32com.client.Dispatch(com_object)
59
+
60
+ @property
61
+ def name(self) -> str:
62
+ return self.com_object.Name
63
+
64
+ def is_running(self) -> bool:
65
+ return self.com_object.IsRunning()
66
+
67
+ def run(self):
68
+ self.com_object.Run()
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,64 @@
1
+ import win32com.client
2
+
3
+ from py_canoe.core.child_elements.test_modules import TestModules
4
+ from py_canoe.core.child_elements.test_setup_folders import TestSetupFolders
5
+
6
+
7
+ class TestEnvironment:
8
+ """The TestEnvironment object represents a test environment within CANoe's test setup."""
9
+ def __init__(self, com_object):
10
+ self.com_object = win32com.client.Dispatch(com_object)
11
+ self.__test_modules = TestModules(self.com_object.TestModules)
12
+ self.__test_setup_folders = TestSetupFolders(self.com_object.Folders)
13
+ self.__all_test_modules = {}
14
+ self.__all_test_setup_folders = {}
15
+
16
+ @property
17
+ def enabled(self) -> bool:
18
+ return self.com_object.Enabled
19
+
20
+ @enabled.setter
21
+ def enabled(self, value: bool) -> None:
22
+ self.com_object.Enabled = value
23
+
24
+ @property
25
+ def full_name(self) -> str:
26
+ return self.com_object.FullName
27
+
28
+ @property
29
+ def name(self) -> str:
30
+ return self.com_object.Name
31
+
32
+ @property
33
+ def path(self) -> str:
34
+ return self.com_object.Path
35
+
36
+ def execute_all(self) -> None:
37
+ self.com_object.ExecuteAll()
38
+
39
+ def save(self, name: str, prompt_user=False) -> None:
40
+ self.com_object.Save(name, prompt_user)
41
+
42
+ def save_as(self, name: str, major: int, minor: int, prompt_user=False) -> None:
43
+ self.com_object.SaveAs(name, major, minor, prompt_user)
44
+
45
+ def stop_sequence(self) -> None:
46
+ self.com_object.StopSequence()
47
+
48
+ def update_all_test_setup_folders(self, tsfs_instance=None):
49
+ if tsfs_instance is None:
50
+ tsfs_instance = self.__test_setup_folders
51
+ if tsfs_instance.count > 0:
52
+ test_setup_folders = tsfs_instance.fetch_test_setup_folders()
53
+ for tsf_name, tsf_inst in test_setup_folders.items():
54
+ self.__all_test_setup_folders[tsf_name] = tsf_inst
55
+ if tsf_inst.test_modules.count > 0:
56
+ self.__all_test_modules.update(tsf_inst.test_modules.fetch_test_modules())
57
+ if tsf_inst.folders.count > 0:
58
+ tsfs_instance = tsf_inst.folders
59
+ self.update_all_test_setup_folders(tsfs_instance)
60
+
61
+ def get_all_test_modules(self):
62
+ self.update_all_test_setup_folders()
63
+ self.__all_test_modules.update(self.__test_modules.fetch_test_modules())
64
+ return self.__all_test_modules
@@ -0,0 +1,26 @@
1
+ import win32com.client
2
+
3
+ from py_canoe.core.child_elements.test_environment import TestEnvironment
4
+
5
+
6
+ class TestEnvironments:
7
+ """The TestEnvironments object represents the test environments within CANoe's test setup."""
8
+ def __init__(self, com_object):
9
+ self.com_object = win32com.client.Dispatch(com_object)
10
+
11
+ @property
12
+ def count(self) -> int:
13
+ return self.com_object.Count
14
+
15
+ def add(self, name: str) -> 'TestEnvironment':
16
+ return TestEnvironment(self.com_object.Add(name))
17
+
18
+ def remove(self, index: int, prompt_user=False) -> None:
19
+ self.com_object.Remove(index, prompt_user)
20
+
21
+ def fetch_all_test_environments(self) -> dict['str': 'TestEnvironment']:
22
+ test_environments = dict()
23
+ for index in range(1, self.count + 1):
24
+ te_inst = TestEnvironment(self.com_object.Item(index))
25
+ test_environments[te_inst.name] = te_inst
26
+ return test_environments
@@ -0,0 +1,213 @@
1
+ import win32com.client
2
+
3
+ from py_canoe.helpers.common import logger, wait, DoEventsUntil
4
+
5
+ TEST_MODULE_START_EVENT_TIMEOUT = 5 # seconds
6
+
7
+
8
+ class TestModuleEvents:
9
+ """test module events object."""
10
+ def __init__(self):
11
+ self.TM_STARTED = False
12
+ self.TM_PAUSED = False
13
+ self.TM_STOPPED = False
14
+ self.TM_STOP_REASON = -1
15
+ self.VALUE_TABLE_STOP_REASON = {
16
+ 0: "TestModuleEnd: The test module was executed completely",
17
+ 1: "UserAbortion: The test module was stopped by the user",
18
+ 2: "GeneralError: The test module was stopped by measurement stop"
19
+ }
20
+ self.TM_REPORT_GENERATED = False
21
+ self.TEST_REPORT_INFORMATION = dict()
22
+ self.TC_FAIL = False
23
+
24
+ def OnStart(self):
25
+ self.TM_STARTED = True
26
+
27
+ def OnPause(self):
28
+ self.TM_PAUSED = True
29
+
30
+ def OnStop(self, reason):
31
+ self.TM_STOP_REASON = reason
32
+ self.TM_STOPPED = True
33
+
34
+ def OnReportGenerated(self, success, sourceFullName, generatedFullName):
35
+ self.TEST_REPORT_INFORMATION = {
36
+ "success": success,
37
+ "source_full_name": sourceFullName,
38
+ "generated_full_name": generatedFullName
39
+ }
40
+ self.TM_REPORT_GENERATED = True
41
+
42
+ def OnVerdictFail(self):
43
+ self.TC_FAIL = True
44
+
45
+
46
+ class TestModule:
47
+ """The TestModule object represents a test module in CANoe's test setup."""
48
+
49
+ def __init__(self, com_object):
50
+ self.com_object = win32com.client.Dispatch(com_object)
51
+ self.test_module_events: TestModuleEvents = win32com.client.WithEvents(self.com_object, TestModuleEvents)
52
+ self.VALUE_TABLE_VERDICT = {
53
+ 0: "NotAvailable",
54
+ 1: "Passed",
55
+ 2: "Failed",
56
+ 3: "None",
57
+ 4: "Inconclusive",
58
+ 5: "ErrorInTestSystem"
59
+ }
60
+ self.VALUE_TABLE_VERDICT_IMPACT = {
61
+ 0: "NoImpact",
62
+ 1: "EndTestCaseOnFail",
63
+ 2: "EndTestModuleOnFail"
64
+ }
65
+
66
+ @property
67
+ def name(self) -> str:
68
+ return self.com_object.Name
69
+
70
+ @property
71
+ def full_name(self) -> str:
72
+ return self.com_object.FullName
73
+
74
+ @property
75
+ def path(self) -> str:
76
+ return self.com_object.Path
77
+
78
+ @property
79
+ def number_of_executions(self) -> int:
80
+ return self.com_object.NumberOfExecutions
81
+
82
+ @number_of_executions.setter
83
+ def number_of_executions(self, value: int):
84
+ self.com_object.NumberOfExecutions = value
85
+
86
+ @property
87
+ def randomize_each_cycle(self) -> bool:
88
+ return self.com_object.RandomizeEachCycle
89
+
90
+ @randomize_each_cycle.setter
91
+ def randomize_each_cycle(self, value: bool):
92
+ self.com_object.RandomizeEachCycle = value
93
+
94
+ @property
95
+ def start_on_env_var(self) -> str:
96
+ return self.com_object.StartOnEnvVar
97
+
98
+ @start_on_env_var.setter
99
+ def start_on_env_var(self, value: str):
100
+ self.com_object.StartOnEnvVar = value
101
+
102
+ @property
103
+ def start_on_key(self) -> str:
104
+ return self.com_object.StartOnKey
105
+
106
+ @start_on_key.setter
107
+ def start_on_key(self, value: str):
108
+ self.com_object.StartOnKey = value
109
+
110
+ @property
111
+ def start_on_measurement(self) -> bool:
112
+ return self.com_object.StartOnMeasurement
113
+
114
+ @start_on_measurement.setter
115
+ def start_on_measurement(self, value: bool):
116
+ self.com_object.StartOnMeasurement = value
117
+
118
+ @property
119
+ def start_on_sys_var(self) -> str:
120
+ return self.com_object.StartOnSysVar
121
+
122
+ @start_on_sys_var.setter
123
+ def start_on_sys_var(self, value: str):
124
+ self.com_object.StartOnSysVar = value
125
+
126
+ @property
127
+ def test_cases_executed_in_random_order(self) -> bool:
128
+ return self.com_object.TestCasesExecutedInRandomOrder
129
+
130
+ @test_cases_executed_in_random_order.setter
131
+ def test_cases_executed_in_random_order(self, value: bool):
132
+ self.com_object.TestCasesExecutedInRandomOrder = value
133
+
134
+ @property
135
+ def test_state_sys_var(self) -> str:
136
+ return self.com_object.TestStateSysVar
137
+
138
+ @test_state_sys_var.setter
139
+ def test_state_sys_var(self, value: str):
140
+ self.com_object.TestStateSysVar = value
141
+
142
+ @property
143
+ def verdict(self) -> int:
144
+ return self.com_object.Verdict
145
+
146
+ @property
147
+ def verdict_impact(self) -> int:
148
+ return self.com_object.VerdictImpact
149
+
150
+ @verdict_impact.setter
151
+ def verdict_impact(self, value: int):
152
+ self.com_object.VerdictImpact = value
153
+
154
+ def _init_tm_event_variables(self):
155
+ self.test_module_events.TM_STARTED = False
156
+ self.test_module_events.TM_PAUSED = False
157
+ self.test_module_events.TM_STOPPED = False
158
+ self.test_module_events.TM_STOP_REASON = -1
159
+ self.test_module_events.TM_REPORT_GENERATED = False
160
+ self.test_module_events.TEST_REPORT_INFORMATION = dict()
161
+ self.test_module_events.TC_FAIL = False
162
+
163
+ def start(self):
164
+ self._init_tm_event_variables()
165
+ self.com_object.Start()
166
+ status = DoEventsUntil(lambda: self.test_module_events.TM_STARTED, TEST_MODULE_START_EVENT_TIMEOUT, "Test Module Start")
167
+ if status:
168
+ logger.info(f'🧪🏃‍➡️ started executing test module ({self.name})...')
169
+
170
+ def wait_for_completion(self) -> bool:
171
+ return_value = False
172
+ if self.test_module_events.TM_STARTED:
173
+ logger.info(f'🧪🥱 waiting for test module ({self.name}) to complete...')
174
+ while not self.test_module_events.TM_STOPPED:
175
+ wait(0.01)
176
+ logger.info(f'🧪🧍 test module ({self.name}) execution completed with stop reason 👉 {self.test_module_events.VALUE_TABLE_STOP_REASON[self.test_module_events.TM_STOP_REASON]}')
177
+ return_value = True
178
+ else:
179
+ logger.warning(f'🧪⚠️ Test Module ({self.name}) is not started. Start the Test Module first.')
180
+ return return_value
181
+
182
+ def pause(self) -> bool:
183
+ if self.test_module_events.TM_STARTED:
184
+ self.com_object.Pause()
185
+ logger.info(f'🧪🥱 pausing test module ({self.name}). please wait...')
186
+ while not self.test_module_events.TM_PAUSED:
187
+ wait(0.01)
188
+ logger.info(f'🧪⏸️ paused test module ({self.name}).')
189
+ return True
190
+ else:
191
+ logger.warning(f'🧪⚠️ Test Module ({self.name}) is not started. Start the Test Module first.')
192
+ return False
193
+
194
+ def resume(self) -> None:
195
+ self.com_object.Resume()
196
+
197
+ def stop(self) -> bool:
198
+ if self.test_module_events.TM_STARTED:
199
+ self.com_object.Stop()
200
+ logger.info(f'🧪🥱 stopping test module ({self.name}). please wait...')
201
+ while not self.test_module_events.TM_STOPPED:
202
+ wait(0.01)
203
+ logger.info(f'🧪⏹️ stopped test module ({self.name}).')
204
+ return True
205
+ else:
206
+ logger.warning(f'🧪⚠️ Test Module ({self.name}) is not started. Start the Test Module first.')
207
+ return False
208
+
209
+ def reload(self) -> None:
210
+ self.com_object.Reload()
211
+
212
+ def set_execution_time(self, days: int, hours: int, minutes: int):
213
+ self.com_object.SetExecutionTime(days, hours, minutes)
@@ -0,0 +1,23 @@
1
+ from py_canoe.core.child_elements.test_module import TestModule
2
+
3
+
4
+ class TestModules:
5
+ def __init__(self, com_object) -> None:
6
+ self.com_object = com_object
7
+
8
+ @property
9
+ def count(self) -> int:
10
+ return self.com_object.Count
11
+
12
+ def add(self, full_name: str) -> 'TestModule':
13
+ return TestModule(self.com_object.Add(full_name))
14
+
15
+ def remove(self, index: int, prompt_user=False) -> None:
16
+ self.com_object.Remove(index, prompt_user)
17
+
18
+ def fetch_test_modules(self) -> dict['str': 'TestModule']:
19
+ test_modules = dict()
20
+ for index in range(1, self.count + 1):
21
+ tm_inst = TestModule(self.com_object.Item(index))
22
+ test_modules[tm_inst.name] = tm_inst
23
+ return test_modules
@@ -0,0 +1,16 @@
1
+ import win32com.client
2
+
3
+ from py_canoe.core.child_elements.test_environments import TestEnvironments
4
+
5
+
6
+ class TestSetup:
7
+ """The TestSetup object represents CANoe's test setup."""
8
+ def __init__(self, com_object):
9
+ self.com_object = win32com.client.Dispatch(com_object)
10
+
11
+ def save_all(self, prompt_user=False) -> None:
12
+ self.com_object.SaveAll(prompt_user)
13
+
14
+ @property
15
+ def test_environments(self) -> 'TestEnvironments':
16
+ return TestEnvironments(self.com_object.TestEnvironments)
@@ -0,0 +1,36 @@
1
+ import win32com.client
2
+
3
+ from py_canoe.core.child_elements.test_modules import TestModules
4
+
5
+
6
+ class TestSetupFolderExt:
7
+ """The TestSetupFolderExt object represents a directory in CANoe's test setup."""
8
+ def __init__(self, com_object) -> None:
9
+ self.com_object = win32com.client.Dispatch(com_object)
10
+
11
+ @property
12
+ def enabled(self) -> bool:
13
+ return self.com_object.Enabled
14
+
15
+ @enabled.setter
16
+ def enabled(self, enabled: bool):
17
+ self.com_object.Enabled = enabled
18
+
19
+ @property
20
+ def name(self) -> str:
21
+ return self.com_object.Name
22
+
23
+ @property
24
+ def folders(self):
25
+ from py_canoe.core.child_elements.test_setup_folders import TestSetupFolders
26
+ return TestSetupFolders(self.com_object.Folders)
27
+
28
+ @property
29
+ def test_modules(self) -> 'TestModules':
30
+ return TestModules(self.com_object.TestModules)
31
+
32
+ def execute_all(self):
33
+ self.com_object.ExecuteAll()
34
+
35
+ def stop_sequence(self):
36
+ self.com_object.StopSequence()
@@ -0,0 +1,25 @@
1
+ from py_canoe.core.child_elements.test_setup_folder_ext import TestSetupFolderExt
2
+
3
+
4
+ class TestSetupFolders:
5
+ """The TestSetupFolders object represents the folders in a test environment or in a test setup folder."""
6
+ def __init__(self, com_object) -> None:
7
+ self.com_object = com_object
8
+
9
+ @property
10
+ def count(self) -> int:
11
+ return self.com_object.Count
12
+
13
+ def add(self, full_name: str) -> 'TestSetupFolderExt':
14
+ return TestSetupFolderExt(self.com_object.Add(full_name))
15
+
16
+ def remove(self, index: int, prompt_user=False) -> None:
17
+ self.com_object.Remove(index, prompt_user)
18
+
19
+ def fetch_test_setup_folders(self) -> dict:
20
+ test_setup_folders = dict()
21
+ for index in range(1, self.count + 1):
22
+ tsf_com_obj = self.com_object.Item(index)
23
+ tsf_inst = TestSetupFolderExt(tsf_com_obj)
24
+ test_setup_folders[tsf_inst.name] = tsf_inst
25
+ return test_setup_folders
File without changes
@@ -0,0 +1,144 @@
1
+ from typing import Union
2
+ import win32com.client
3
+
4
+ from py_canoe.helpers.common import logger, DoEventsUntil
5
+ from py_canoe.core.child_elements.encodings import Encodings
6
+ from py_canoe.core.child_elements.variable_events import VariableEvents
7
+
8
+
9
+ class Variable:
10
+ def __init__(self, com_object, enable_events: bool = True):
11
+ self.com_object = win32com.client.Dispatch(com_object)
12
+ self.enable_events = enable_events
13
+ if self.enable_events:
14
+ self.variable_events: VariableEvents = win32com.client.WithEvents(self.com_object, VariableEvents)
15
+
16
+ @property
17
+ def analysis_only(self) -> bool:
18
+ return self.com_object.AnalysisOnly
19
+
20
+ @analysis_only.setter
21
+ def analysis_only(self, value: bool = False):
22
+ self.com_object.AnalysisOnly = value
23
+
24
+ @property
25
+ def bit_count(self) -> int:
26
+ return self.com_object.BitCount
27
+
28
+ @property
29
+ def comment(self) -> str:
30
+ return self.com_object.Comment
31
+
32
+ @property
33
+ def element_count(self) -> int:
34
+ return self.com_object.ElementCount
35
+
36
+ @property
37
+ def encodings(self) -> Encodings:
38
+ return Encodings(self.com_object.Encodings)
39
+
40
+ @property
41
+ def full_name(self) -> str:
42
+ return self.com_object.FullName
43
+
44
+ @property
45
+ def init_value(self) -> Union[int, float]:
46
+ return self.com_object.InitValue
47
+
48
+ @property
49
+ def is_array(self) -> bool:
50
+ return self.com_object.IsArray
51
+
52
+ @property
53
+ def is_member(self) -> bool:
54
+ return self.com_object.IsMember
55
+
56
+ @property
57
+ def is_signed(self) -> bool:
58
+ return self.com_object.IsSigned
59
+
60
+ @property
61
+ def is_struct(self) -> bool:
62
+ return self.com_object.IsStruct
63
+
64
+ @property
65
+ def max_value(self) -> Union[int, float]:
66
+ return self.com_object.MaxValue
67
+
68
+ @property
69
+ def member_name(self) -> str:
70
+ return self.com_object.MemberName
71
+
72
+ @property
73
+ def members(self):
74
+ from py_canoe.core.child_elements.variables import Variables
75
+ return Variables(self.com_object.Members)
76
+
77
+ @property
78
+ def min_value(self) -> Union[int, float]:
79
+ return self.com_object.MinValue
80
+
81
+ @property
82
+ def name(self) -> str:
83
+ return self.com_object.Name
84
+
85
+ @property
86
+ def notification_type(self) -> int:
87
+ return self.com_object.NotificationType
88
+
89
+ @property
90
+ def physical_init_value(self) -> Union[int, float]:
91
+ return self.com_object.PhysicalInitValue
92
+
93
+ @property
94
+ def physical_value(self) -> Union[int, float]:
95
+ return self.com_object.PhysicalValue
96
+
97
+ @property
98
+ def read_only(self) -> bool:
99
+ return self.com_object.ReadOnly
100
+
101
+ @property
102
+ def type(self) -> int:
103
+ return self.com_object.Type
104
+
105
+ @property
106
+ def unit(self) -> str:
107
+ return self.com_object.Unit
108
+
109
+ def get_value(self):
110
+ return self.com_object.Value
111
+
112
+ def set_value(self, value, timeout: Union[int, float]):
113
+ status: bool = False
114
+ self.com_object.Value = value
115
+ if self.variable_events:
116
+ self.variable_events.VARIABLE_UPDATED = False
117
+ status = DoEventsUntil(lambda: self.variable_events.VARIABLE_UPDATED, timeout, "Variable Update")
118
+ if status:
119
+ logger.info(f"📢 Variable '{self.full_name}' updated successfully to: {value}")
120
+ return status
121
+
122
+ def begin_struct_update(self):
123
+ self.com_object.BeginStructUpdate()
124
+
125
+ def end_struct_update(self):
126
+ self.com_object.EndStructUpdate()
127
+
128
+ def get_member_phys_value(self, member_name: str) -> Union[int, float]:
129
+ return self.com_object.GetMemberPhysValue(member_name)
130
+
131
+ def get_member_value(self, member_name: str) -> Union[int, float]:
132
+ return self.com_object.GetMemberValue(member_name)
133
+
134
+ def get_symbolic_value_name(self, value: Union[int, float]) -> str:
135
+ return self.com_object.GetSymbolicValueName(value)
136
+
137
+ def set_member_phys_value(self, member_name: str, value: Union[int, float]):
138
+ self.com_object.SetMemberPhysValue(member_name, value)
139
+
140
+ def set_member_value(self, member_name: str, value: Union[int, float]):
141
+ self.com_object.SetMemberValue(member_name, value)
142
+
143
+ def set_symbolic_value_name(self, value: Union[int, float], name: str):
144
+ self.com_object.SetSymbolicValueName(value, name)
@@ -0,0 +1,14 @@
1
+ class VariableEvents:
2
+ def __init__(self) -> None:
3
+ self.VARIABLE_INFO = {}
4
+ self.VARIABLE_UPDATED = False
5
+
6
+ def OnChange(self, value):
7
+ self.VARIABLE_INFO['value'] = value
8
+ self.VARIABLE_UPDATED = True
9
+
10
+ def OnChangeAndTime(self, value, timeHigh, time):
11
+ self.VARIABLE_INFO['value'] = value
12
+ self.VARIABLE_INFO['timeHigh'] = timeHigh
13
+ self.VARIABLE_INFO['time'] = time
14
+ self.VARIABLE_UPDATED = True