holado 0.2.7__py3-none-any.whl → 0.3.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.
Potentially problematic release.
This version of holado might be problematic. Click here for more details.
- holado/common/handlers/undefined.py +7 -1
- {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/METADATA +7 -1
- {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/RECORD +116 -107
- holado_ais/ais/ais_messages.py +97 -6
- holado_ais/tests/behave/steps/ais/ais_manager_steps.py +1 -1
- holado_ais/tests/behave/steps/ais/ais_messages_steps.py +45 -6
- holado_binary/ipc/bit_series.py +3 -3
- holado_binary/tests/behave/steps/ipc/binary_steps.py +1 -1
- holado_binary/tests/behave/steps/ipc/bit_series_steps.py +4 -3
- holado_context/tests/behave/steps/private/common/context_steps.py +1 -1
- holado_core/common/resource/persisted_data_manager.py +13 -16
- holado_core/common/resource/resource_manager.py +10 -10
- holado_core/common/tables/converters/table_converter.py +47 -9
- holado_core/common/tables/table.py +2 -2
- holado_core/common/tables/table_manager.py +6 -7
- holado_core/common/tables/table_with_header.py +6 -0
- holado_core/common/tools/string_tools.py +9 -0
- holado_core/tests/behave/steps/common/common_steps.py +2 -1
- holado_core/tests/behave/steps/common/config_steps.py +1 -1
- holado_core/tests/behave/steps/common/resource_steps.py +1 -1
- holado_core/tests/behave/steps/common/tables_steps.py +27 -4
- holado_data/data/generator/generator_manager.py +39 -0
- holado_data/tests/behave/steps/data/generator_steps.py +1 -1
- holado_data/tests/behave/steps/tools/utils_steps.py +1 -2
- holado_db/tests/behave/steps/tools/db/db_client_steps.py +1 -1
- holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py +1 -1
- holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py +1 -1
- holado_db/tools/db/clients/base/db_client.py +81 -28
- holado_db/tools/db/clients/postgresql/postgresql_client.py +17 -7
- holado_db/tools/db/query/base/query_builder.py +58 -7
- holado_db/tools/db/query/pypika/pypika_query_builder.py +73 -21
- holado_docker/tests/behave/steps/tools/docker_steps.py +1 -1
- holado_grpc/tests/behave/steps/api/grpc_client_steps.py +1 -1
- holado_grpc/tests/behave/steps/private/api/grpc_steps.py +1 -1
- holado_helper/script/action.py +16 -7
- holado_json/tests/behave/steps/ipc/json_steps.py +1 -1
- holado_keycloak/tests/behave/steps/tools/keycloak_client_steps.py +1 -1
- holado_multitask/tests/behave/steps/multiprocessing_steps.py +1 -1
- holado_multitask/tests/behave/steps/multithreading_steps.py +1 -1
- holado_protobuf/ipc/protobuf/types/google/protobuf.py +1 -1
- holado_protobuf/tests/behave/steps/ipc/protobuf_steps.py +1 -1
- holado_python/common/tools/datetime.py +31 -12
- holado_python/standard_library/socket/blocking_socket.py +112 -42
- holado_python/standard_library/socket/echo_server.py +4 -3
- holado_python/standard_library/socket/message_socket.py +69 -22
- holado_python/standard_library/socket/non_blocking_socket.py +65 -67
- holado_python/standard_library/socket/socket.py +272 -32
- holado_python/standard_library/ssl/resources/certificates/NOTES.txt +1 -1
- holado_python/standard_library/ssl/resources/certificates/rootCACert.pem +24 -0
- holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +21 -0
- holado_python/standard_library/ssl/resources/certificates/tcpbin.key +28 -0
- holado_python/standard_library/ssl/ssl.py +138 -21
- holado_python/tests/behave/steps/convert_steps.py +1 -1
- holado_python/tests/behave/steps/iterable_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/csv_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/datetime_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/hashlib_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/multiprocessing_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/queue_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/socket_steps.py +147 -21
- holado_python/tests/behave/steps/standard_library/ssl_steps.py +87 -16
- holado_rabbitmq/tests/behave/steps/tools/rabbitmq_client_steps.py +48 -20
- holado_rabbitmq/tests/behave/steps/tools/rabbitmq_server_steps.py +1 -1
- holado_rabbitmq/tools/rabbitmq/rabbitmq_client.py +19 -13
- holado_rabbitmq/tools/rabbitmq/rabbitmq_manager.py +2 -29
- holado_redis/tests/behave/steps/tools/redis_client_steps.py +1 -1
- holado_rest/tests/behave/steps/api/rest_client_steps.py +1 -1
- holado_rest/tests/behave/steps/private/api/rest_steps.py +1 -1
- holado_s3/tests/behave/steps/private/tools/s3_steps.py +1 -1
- holado_s3/tests/behave/steps/tools/s3_client_steps.py +1 -1
- holado_s3/tests/behave/steps/tools/s3_server_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_convert_steps.py +3 -2
- holado_scripting/tests/behave/steps/common/tools/variable_new_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_verify_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/function_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/if_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/loop_steps.py +1 -1
- holado_scripting/text/interpreter/functions/function_apply_function.py +60 -0
- holado_scripting/text/interpreter/functions/function_to_string.py +50 -0
- holado_scripting/text/interpreter/text_interpreter.py +4 -0
- holado_sftp/tests/behave/steps/private/tools/sftp_steps.py +1 -1
- holado_sftp/tests/behave/steps/tools/sftp_client_steps.py +1 -1
- holado_sftp/tests/behave/steps/tools/sftp_server_steps.py +1 -1
- holado_swagger/tests/behave/steps/swagger_hub/mockserver_steps.py +1 -1
- holado_system/system/command/command.py +14 -9
- holado_system/tests/behave/steps/system/commands_steps.py +1 -1
- holado_system/tests/behave/steps/system/file_steps.py +1 -1
- holado_system/tests/behave/steps/system/system_steps.py +1 -1
- holado_test/scenario/step_tools.py +5 -4
- holado_test/scenario/tester_tools.py +6 -3
- holado_test/tests/behave/steps/scenario/exception_steps.py +1 -1
- holado_test/tests/behave/steps/scenario/scenario_steps.py +1 -1
- holado_test/tests/behave/steps/scenario/tester_steps.py +4 -4
- holado_value/common/tables/converters/value_table_converter.py +52 -8
- holado_value/common/tables/value_table_cell.py +5 -0
- holado_value/common/tables/value_table_manager.py +0 -10
- holado_value/common/tables/value_table_row.py +0 -1
- holado_value/common/tools/value.py +5 -1
- holado_ws/tests/behave/steps/api/web_service_steps.py +1 -1
- holado_yaml/tests/behave/steps/yaml_steps.py +1 -1
- holado_yaml/yaml/yaml_manager.py +2 -2
- test_holado/features/NonReg/common/tables/table.feature +30 -24
- test_holado/features/NonReg/holado_ais/ais_message-bitarray_to_nmea.feature +1 -1
- test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_reset.feature +191 -0
- test_holado/features/NonReg/holado_python/standard_library/{socket_with_ssl.feature → socket/local_echo_server/socket_with_tls_and_verify.feature} +126 -27
- test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_with_tls_without_verify.feature +299 -0
- test_holado/features/NonReg/holado_python/standard_library/{socket.feature → socket/local_echo_server/socket_without_tls.feature} +63 -1
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_mtls.feature +214 -0
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_tls.feature +184 -0
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_without_tls.feature +169 -0
- test_holado/features/NonReg/tools/RabbitMQ.feature +9 -9
- test_holado/features/NonReg/tools/RabbitMQ_steps.feature +8 -8
- test_holado/logging.conf +5 -3
- holado_core/common/transport/__init__.py +0 -0
- holado_core/common/transport/crc.py +0 -40
- {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/WHEEL +0 -0
- {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -209,7 +209,7 @@ class RMQClient(DeleteableObject):
|
|
|
209
209
|
def _new_publisher_with_connection(self, connection, queue, queue_args=None, exchange="", exchange_args=None, routing_key=None, nb_runners=None):
|
|
210
210
|
pub_channel = connection.channel()
|
|
211
211
|
|
|
212
|
-
queue_name = self.
|
|
212
|
+
queue_name = self._prepare_queue(pub_channel, queue, queue_args, exchange, exchange_args, bind_args=None)
|
|
213
213
|
if self.connection.publisher_confirms:
|
|
214
214
|
pub_channel.set_confirm_delivery()
|
|
215
215
|
else:
|
|
@@ -236,7 +236,7 @@ class RMQClient(DeleteableObject):
|
|
|
236
236
|
|
|
237
237
|
if self.is_consuming:
|
|
238
238
|
raise FunctionalException(f"[{self.name}] Not allowed to create a new consumer while consuming is started")
|
|
239
|
-
queue_name = self.
|
|
239
|
+
queue_name = self._prepare_queue(con_channel, queue, queue_args, exchange, exchange_args, bind_args)
|
|
240
240
|
res = RMQConsumer(self, connection, con_channel, queue_name, message_callback)
|
|
241
241
|
self.__consumer_and_kwargs.append( self.__new_object_kwargs(res, queue=queue, message_callback=message_callback, queue_args=queue_args, exchange=exchange, exchange_args=exchange_args, bind_args=bind_args) )
|
|
242
242
|
return res
|
|
@@ -249,7 +249,7 @@ class RMQClient(DeleteableObject):
|
|
|
249
249
|
|
|
250
250
|
if self.is_consuming:
|
|
251
251
|
raise FunctionalException(f"[{self.name}] Not allowed to create a new consumer while consuming is started")
|
|
252
|
-
queue_name = self.
|
|
252
|
+
queue_name = self._prepare_queue(con_channel, queue, queue_args, exchange, exchange_args, bind_args)
|
|
253
253
|
res = RMQBufferConsumer(self, connection, con_channel, queue_name)
|
|
254
254
|
self.__buffer_consumer_and_kwargs.append( self.__new_object_kwargs(res, queue=queue, queue_args=queue_args, exchange=exchange, exchange_args=exchange_args, bind_args=bind_args) )
|
|
255
255
|
return res
|
|
@@ -324,25 +324,31 @@ class RMQClient(DeleteableObject):
|
|
|
324
324
|
if Tools.do_log(logger, logging.DEBUG):
|
|
325
325
|
logger.debug(f"[{self.name}] Finished stop data events processing")
|
|
326
326
|
|
|
327
|
-
def
|
|
327
|
+
def _prepare_queue(self, channel, queue, queue_args=None, exchange="", exchange_args=None, bind_args=None):
|
|
328
328
|
if exchange is not None and exchange != "":
|
|
329
|
-
self.
|
|
329
|
+
self._exchange_declare(channel, exchange, exchange_args)
|
|
330
330
|
|
|
331
331
|
if queue is not None and queue != "":
|
|
332
|
-
self.
|
|
332
|
+
self._queue_declare(channel, queue, queue_args)
|
|
333
333
|
queue_name = queue
|
|
334
334
|
else:
|
|
335
335
|
q_args = dict(queue_args) if queue_args else {}
|
|
336
336
|
q_args['exclusive'] = True
|
|
337
|
-
result = self.
|
|
337
|
+
result = self._queue_declare(channel, queue, q_args)
|
|
338
338
|
queue_name = result.method.queue
|
|
339
339
|
|
|
340
340
|
if exchange is not None and exchange != "":
|
|
341
|
-
self.
|
|
341
|
+
self._queue_bind(channel, queue_name, exchange, bind_args)
|
|
342
342
|
|
|
343
343
|
return queue_name
|
|
344
|
-
|
|
345
|
-
def
|
|
344
|
+
|
|
345
|
+
def delete_queue(self, queue):
|
|
346
|
+
self.connection.channel().queue_delete(queue=queue)
|
|
347
|
+
|
|
348
|
+
def purge_queue(self, queue):
|
|
349
|
+
self.connection.channel().queue_purge(queue)
|
|
350
|
+
|
|
351
|
+
def _exchange_declare(self, channel, exchange, exchange_args=None):
|
|
346
352
|
kwargs = {}
|
|
347
353
|
arguments = None
|
|
348
354
|
if exchange_args:
|
|
@@ -352,7 +358,7 @@ class RMQClient(DeleteableObject):
|
|
|
352
358
|
kwargs[name] = arguments.pop(name)
|
|
353
359
|
return channel.exchange_declare(exchange, arguments=arguments, **kwargs)
|
|
354
360
|
|
|
355
|
-
def
|
|
361
|
+
def _queue_declare(self, channel, queue, queue_args=None):
|
|
356
362
|
kwargs = {}
|
|
357
363
|
arguments = None
|
|
358
364
|
if queue_args:
|
|
@@ -362,7 +368,7 @@ class RMQClient(DeleteableObject):
|
|
|
362
368
|
kwargs[name] = arguments.pop(name)
|
|
363
369
|
return channel.queue_declare(queue, arguments=arguments, **kwargs)
|
|
364
370
|
|
|
365
|
-
def
|
|
371
|
+
def _queue_bind(self, channel, queue, exchange, bind_args=None):
|
|
366
372
|
kwargs = {}
|
|
367
373
|
arguments = None
|
|
368
374
|
if bind_args:
|
|
@@ -374,7 +380,7 @@ class RMQClient(DeleteableObject):
|
|
|
374
380
|
|
|
375
381
|
def get_queue_message_count(self, queue):
|
|
376
382
|
channel = self.connection.channel()
|
|
377
|
-
status = self.
|
|
383
|
+
status = self._queue_declare(channel, queue, {'passive':True})
|
|
378
384
|
return status.method.message_count
|
|
379
385
|
|
|
380
386
|
def is_queue_empty(self, queue, raise_exception=False):
|
|
@@ -36,39 +36,12 @@ class RMQManager:
|
|
|
36
36
|
return res
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def
|
|
39
|
+
def await_message_reception(self, consumers, timeout_seconds=None, polling_seconds=None, raise_exception=True):
|
|
40
40
|
"""Wait until one of the buffer consumers has received a message.
|
|
41
41
|
@param consumers: list of buffer consumers
|
|
42
42
|
@param timeout_seconds: wait timeout
|
|
43
43
|
@param polling_seconds: time to wait between pollings of received messages of all consumers
|
|
44
44
|
"""
|
|
45
|
-
# res = 0
|
|
46
|
-
#
|
|
47
|
-
# if timeout_seconds is None:
|
|
48
|
-
# timeout_seconds = Config.timeout_seconds
|
|
49
|
-
# if polling_seconds is None:
|
|
50
|
-
# polling_seconds = timeout_seconds / 1000
|
|
51
|
-
# if polling_seconds > 0.01:
|
|
52
|
-
# polling_seconds = 0.01
|
|
53
|
-
#
|
|
54
|
-
# # Wait first message
|
|
55
|
-
# dt_begin = datetime.now()
|
|
56
|
-
# dt_last_poll = dt_begin
|
|
57
|
-
# while (dt_last_poll - dt_begin).total_seconds() < timeout_seconds:
|
|
58
|
-
# nb_msg_by_consumer = {c.name: c.nb_messages for c in consumers if c.nb_messages > 0}
|
|
59
|
-
# dt_last_poll = datetime.now()
|
|
60
|
-
# if len(nb_msg_by_consumer) > 0:
|
|
61
|
-
# if Tools.do_log(logger, logging.DEBUG):
|
|
62
|
-
# logger.debug(f"Received messages: " + " ; ".join(f"{k}:{v}" for k,v in nb_msg_by_consumer.items()))
|
|
63
|
-
# res = sum(nb_msg_by_consumer.values())
|
|
64
|
-
# if res > 0:
|
|
65
|
-
# break
|
|
66
|
-
# time.sleep(polling_seconds)
|
|
67
|
-
#
|
|
68
|
-
# if res == 0 and raise_exception:
|
|
69
|
-
# names = ",".join([c.name for c in consumers])
|
|
70
|
-
# raise FunctionalException(f"[{names}] No message was received (timeout: {timeout_seconds} seconds)")
|
|
71
|
-
# return res
|
|
72
45
|
if raise_exception is None:
|
|
73
46
|
raise_exception = True
|
|
74
47
|
|
|
@@ -90,7 +63,7 @@ class RMQManager:
|
|
|
90
63
|
|
|
91
64
|
#TODO EKL: add a first_accepted_seconds and a accepted_window_seconds to be able to raise an exception that first or next message arrived but too late
|
|
92
65
|
#TODO EKL: change use of polling_seconds to something like a timer, rather than waiting polling_seconds
|
|
93
|
-
def
|
|
66
|
+
def await_messages_reception(self, consumers, first_timeout_seconds=None, window_seconds=None, polling_seconds=None, raise_exception=True):
|
|
94
67
|
"""Wait until buffer consumers stop to receive messages.
|
|
95
68
|
It begins by waiting a first message in any consumer, since their creation or last reset.
|
|
96
69
|
If no consumer receives a first message during first_timeout_seconds period, wait stops.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_scripting.text.interpreter.text_interpreter import TextInterpreter
|
|
21
21
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_rest.api.rest.rest_client import RestClient
|
|
21
21
|
import json
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#################################################
|
|
14
14
|
|
|
15
15
|
from holado.common.context.session_context import SessionContext
|
|
16
|
-
from holado_test.behave.behave import *
|
|
16
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
17
17
|
import os.path
|
|
18
18
|
import logging
|
|
19
19
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_s3.tools.s3.moto_server import MotoServer
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
import base64
|
|
@@ -26,6 +26,7 @@ from holado_value.common.tables.value_table_with_header import ValueTableWithHea
|
|
|
26
26
|
from holado_value.common.tables.value_table import ValueTable
|
|
27
27
|
from holado_core.common.tools.tools import Tools
|
|
28
28
|
from holado_python.standard_library.typing import Typing
|
|
29
|
+
from holado_value.common.tables.value_table_manager import ValueTableManager
|
|
29
30
|
|
|
30
31
|
logger = logging.getLogger(__name__)
|
|
31
32
|
|
|
@@ -98,7 +99,7 @@ def step_impl(context, var_name, object_value):
|
|
|
98
99
|
row = None
|
|
99
100
|
|
|
100
101
|
if row is not None:
|
|
101
|
-
if
|
|
102
|
+
if ValueTableManager.is_value_table(table):
|
|
102
103
|
res = [c.value for c in row]
|
|
103
104
|
else:
|
|
104
105
|
res = [c.content for c in row]
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
from holado_value.common.tables.value_table_manager import ValueTableManager
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
18
|
from holado.common.context.session_context import SessionContext
|
|
19
|
-
from holado_test.behave.behave import *
|
|
19
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
20
20
|
import logging
|
|
21
21
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
22
22
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
import logging
|
|
21
21
|
import copy
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.tables.table_manager import TableManager
|
|
20
20
|
from holado_value.common.tables.comparators.table_2_value_table_comparator import Table2ValueTable_Comparator
|
|
21
21
|
from holado_core.common.tools.comparators.comparator import CompareOperator
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.block.scope_steps import ScopeSteps
|
|
20
20
|
from holado_core.common.tools.tools import Tools
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.tools.converters.converter import Converter
|
|
20
20
|
from holado_python.standard_library.typing import Typing
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.block.scope_steps import ScopeForSteps, ScopeWhileSteps
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
from holado_scripting.text.base.base_function import BaseFunction
|
|
15
|
+
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
16
|
+
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
17
|
+
import logging
|
|
18
|
+
from holado_core.common.tools.tools import Tools
|
|
19
|
+
from holado_python.standard_library.typing import Typing
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class FunctionApplyFunction(BaseFunction):
|
|
25
|
+
|
|
26
|
+
def __init__(self, func, text_interpreter, var_manager):
|
|
27
|
+
self.__func = func
|
|
28
|
+
self.__text_interpreter = text_interpreter
|
|
29
|
+
self.__variable_manager = var_manager
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def apply(self, args):
|
|
33
|
+
# Verify arguments
|
|
34
|
+
if not isinstance(args, list):
|
|
35
|
+
raise TechnicalException("Arguments must be a list")
|
|
36
|
+
if len(args) != 1:
|
|
37
|
+
raise FunctionalException(f"Function applying a function requires one argument.")
|
|
38
|
+
|
|
39
|
+
src = args[0]
|
|
40
|
+
res = src
|
|
41
|
+
|
|
42
|
+
if isinstance(res, str):
|
|
43
|
+
# Interpret source
|
|
44
|
+
res = self.__text_interpreter.interpret(res)
|
|
45
|
+
|
|
46
|
+
# Manage if source is a variable expression
|
|
47
|
+
if self.__variable_manager.exists_variable(expression=res):
|
|
48
|
+
res = self.__variable_manager.get_value(res)
|
|
49
|
+
|
|
50
|
+
# Remove possible quotes
|
|
51
|
+
if isinstance(res, str):
|
|
52
|
+
if res.startswith("'") and res.endswith("'") or res.startswith('"') and res.endswith('"'):
|
|
53
|
+
res = res.strip("'\"")
|
|
54
|
+
|
|
55
|
+
res = self.__func(res)
|
|
56
|
+
|
|
57
|
+
if Tools.do_log(logger, logging.DEBUG):
|
|
58
|
+
logger.debug(f"[FunctionApplyFunction({self.__func})] [{src}] (type: {Typing.get_object_class_fullname(src)}) -> [{res}] (type: {Typing.get_object_class_fullname(res)})")
|
|
59
|
+
return res
|
|
60
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
from holado_scripting.text.base.base_function import BaseFunction
|
|
15
|
+
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
16
|
+
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
17
|
+
from holado_core.common.tools.string_tools import StrTools
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class FunctionToString(BaseFunction):
|
|
21
|
+
|
|
22
|
+
def __init__(self, text_interpreter, var_manager):
|
|
23
|
+
self.__text_interpreter = text_interpreter
|
|
24
|
+
self.__variable_manager = var_manager
|
|
25
|
+
|
|
26
|
+
def apply(self, args):
|
|
27
|
+
from holado_test.scenario.step_tools import StepTools
|
|
28
|
+
|
|
29
|
+
# Verify arguments
|
|
30
|
+
if not isinstance(args, list):
|
|
31
|
+
raise TechnicalException("Arguments must be a list")
|
|
32
|
+
if len(args) != 1:
|
|
33
|
+
raise FunctionalException("Function 'ToBytes' requires one argument.")
|
|
34
|
+
|
|
35
|
+
src = args[0]
|
|
36
|
+
|
|
37
|
+
# Interpret source
|
|
38
|
+
if isinstance(src, str):
|
|
39
|
+
src = StepTools.extract_string_value(src)
|
|
40
|
+
src = self.__text_interpreter.interpret(src)
|
|
41
|
+
|
|
42
|
+
# Manage if source is a variable expression
|
|
43
|
+
if isinstance(src, str) and self.__variable_manager.exists_variable(expression=src):
|
|
44
|
+
src = self.__variable_manager.get_value(src)
|
|
45
|
+
|
|
46
|
+
# Convert source to bytes
|
|
47
|
+
res = StrTools.to_string(src)
|
|
48
|
+
|
|
49
|
+
return res
|
|
50
|
+
|
|
@@ -30,6 +30,8 @@ from holado_scripting.text.interpreter.functions.function_exists_variable import
|
|
|
30
30
|
from holado_scripting.text.interpreter.functions.function_convert import FunctionConvert
|
|
31
31
|
from holado_python.common.tools.datetime import DateTime
|
|
32
32
|
from holado_python.standard_library.typing import Typing
|
|
33
|
+
from holado_scripting.text.interpreter.functions.function_to_string import FunctionToString
|
|
34
|
+
from holado_scripting.text.interpreter.functions.function_apply_function import FunctionApplyFunction
|
|
33
35
|
|
|
34
36
|
logger = logging.getLogger(__name__)
|
|
35
37
|
|
|
@@ -193,6 +195,7 @@ class TextInterpreter(TextInspecter):
|
|
|
193
195
|
return res
|
|
194
196
|
|
|
195
197
|
def __register_default_functions(self, dynamic_text_manager):
|
|
198
|
+
self.register_function("len", FunctionApplyFunction(len, self, self._variable_manager))
|
|
196
199
|
self.register_function("DynamicValue", FunctionDynamicValue(dynamic_text_manager))
|
|
197
200
|
self.register_function("ExistsVariable", FunctionExistsVariable(self._variable_manager))
|
|
198
201
|
|
|
@@ -206,6 +209,7 @@ class TextInterpreter(TextInspecter):
|
|
|
206
209
|
self.register_function("ToBase64", FunctionToBase64(self, self._variable_manager))
|
|
207
210
|
self.register_function("ToBytes", FunctionToBytes(self, self._variable_manager))
|
|
208
211
|
self.register_function("ToHex", FunctionToHex(self, self._variable_manager))
|
|
212
|
+
self.register_function("ToString", FunctionToString(self, self._variable_manager))
|
|
209
213
|
self.register_function("DatetimeUTCToTAI", FunctionConvert(lambda dt: DateTime.datetime_utc_to_tai(dt), self, self._variable_manager))
|
|
210
214
|
self.register_function("DatetimeTAIToUTC", FunctionConvert(lambda dt: DateTime.datetime_tai_to_utc(dt), self, self._variable_manager))
|
|
211
215
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
import os.path
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_sftp.tools.sftp.sftp_client import SFTPClient
|
|
21
21
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_sftp.tools.sftp.sftp_server import SFTPServer
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
import logging
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_rest.api.rest.rest_client import RestClient
|
|
21
21
|
import json
|
|
@@ -19,6 +19,7 @@ import logging
|
|
|
19
19
|
import time
|
|
20
20
|
from enum import IntEnum
|
|
21
21
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
22
|
+
import copy
|
|
22
23
|
|
|
23
24
|
logger = logging.getLogger(__name__)
|
|
24
25
|
|
|
@@ -35,7 +36,7 @@ class Command(threading.Thread):
|
|
|
35
36
|
Execute a command in a thread.
|
|
36
37
|
"""
|
|
37
38
|
|
|
38
|
-
def __init__(self, cmd, do_log_output = False, do_raise_on_stderr = False):
|
|
39
|
+
def __init__(self, cmd, do_log_output = False, do_raise_on_stderr = False, **subprocess_kwargs):
|
|
39
40
|
"""
|
|
40
41
|
'cmd' argument can be a list or a str. If the global command should contain a '"' in any argument, it is recommanded to pass 'cmd' as a str.
|
|
41
42
|
"""
|
|
@@ -56,6 +57,7 @@ class Command(threading.Thread):
|
|
|
56
57
|
self.__callback = None
|
|
57
58
|
self.__callback_delay_ms = None
|
|
58
59
|
self.__external_parameters = {}
|
|
60
|
+
self.__subprocess_kwargs = subprocess_kwargs
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
@property
|
|
@@ -119,18 +121,21 @@ class Command(threading.Thread):
|
|
|
119
121
|
logger.debug("Call command: {}".format(self.cmd))
|
|
120
122
|
try:
|
|
121
123
|
self.__state = CommandStates.Running
|
|
124
|
+
|
|
125
|
+
kwargs = copy.copy(self.__subprocess_kwargs)
|
|
126
|
+
kwargs['universal_newlines'] = True
|
|
122
127
|
if isinstance(self.cmd, str):
|
|
123
128
|
self.__process = subprocess.Popen(self.cmd,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
stdout=subprocess.PIPE,
|
|
130
|
+
stderr=subprocess.PIPE,
|
|
131
|
+
shell=True,
|
|
132
|
+
**kwargs)
|
|
128
133
|
else:
|
|
129
134
|
self.__process = subprocess.Popen(self.cmd,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
stdout=subprocess.PIPE,
|
|
136
|
+
stderr=subprocess.PIPE,
|
|
137
|
+
shell=False,
|
|
138
|
+
**kwargs)
|
|
134
139
|
|
|
135
140
|
self.__stdout = ""
|
|
136
141
|
self.__stderr = ""
|
|
@@ -6,7 +6,7 @@ from holado_system.system.command.command import Command, CommandStates
|
|
|
6
6
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
7
7
|
from holado_test.scenario.step_tools import StepTools
|
|
8
8
|
from holado_core.tools.abstracts.blocking_command_service import BlockingCommandService
|
|
9
|
-
from holado_test.behave.behave import *
|
|
9
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
10
10
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
11
11
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
12
12
|
from holado_value.common.tables.converters.value_table_converter import ValueTableConverter
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
21
21
|
from holado_value.common.tables.converters.value_table_converter import ValueTableConverter
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
import tempfile
|
|
20
20
|
import logging
|
|
21
21
|
import os
|
|
@@ -34,6 +34,7 @@ from holado_scripting.common.tools.evaluate_parameters import EvaluateParameters
|
|
|
34
34
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
35
35
|
from holado.holado_config import Config
|
|
36
36
|
from holado_python.standard_library.typing import Typing
|
|
37
|
+
from holado_value.common.tables.value_table_manager import ValueTableManager
|
|
37
38
|
|
|
38
39
|
logger = logging.getLogger(__name__)
|
|
39
40
|
|
|
@@ -237,7 +238,7 @@ class StepTools(object):
|
|
|
237
238
|
cell_content = res.header.get_cell(0).content
|
|
238
239
|
if cls._get_variable_manager().exists_variable(variable_name=cell_content):
|
|
239
240
|
value = cls._get_variable_manager().get_variable_value(cell_content)
|
|
240
|
-
if
|
|
241
|
+
if ValueTableManager.is_value_table(value):
|
|
241
242
|
res = value
|
|
242
243
|
elif isinstance(value, TableWithHeader):
|
|
243
244
|
res = ValueTableConverter.convert_table_with_header_2_value_table_with_header(value, do_eval_once=do_eval_once)
|
|
@@ -246,7 +247,7 @@ class StepTools(object):
|
|
|
246
247
|
elif isinstance(table, Table):
|
|
247
248
|
if res.nb_columns == 1 and res.nb_rows == 1:
|
|
248
249
|
value = res.get_row(0).get_cell(0).value
|
|
249
|
-
if
|
|
250
|
+
if ValueTableManager.is_value_table(value):
|
|
250
251
|
res = value
|
|
251
252
|
elif isinstance(value, Table):
|
|
252
253
|
res = ValueTableConverter.convert_table_2_value_table(value, do_eval_once=do_eval_once)
|
|
@@ -302,7 +303,7 @@ class StepTools(object):
|
|
|
302
303
|
|
|
303
304
|
for cell in internal_header:
|
|
304
305
|
scell = ValueTableCell(cell)
|
|
305
|
-
if not
|
|
306
|
+
if not scell.content_type == ValueTypes.Symbol:
|
|
306
307
|
return False
|
|
307
308
|
|
|
308
309
|
return True
|
|
@@ -498,7 +499,7 @@ class StepTools(object):
|
|
|
498
499
|
r"{Variable}|b'[^']*'".format(Variable=cls.get_registered_type_pattern('Variable')),
|
|
499
500
|
StepTools.evaluate_scenario_parameter)
|
|
500
501
|
cls.register_type('Str',
|
|
501
|
-
r"{Variable}|'[^']*'{suffix}".format(Variable=cls.get_registered_type_pattern('Variable'), suffix=regex_suffix),
|
|
502
|
+
r"{Variable}|r?'[^']*'{suffix}".format(Variable=cls.get_registered_type_pattern('Variable'), suffix=regex_suffix),
|
|
502
503
|
StepTools.evaluate_scenario_parameter)
|
|
503
504
|
cls.register_type('RawStr',
|
|
504
505
|
r"{Variable}|'.*'{suffix}".format(Variable=cls.get_registered_type_pattern('Variable'), suffix=regex_suffix),
|
|
@@ -37,11 +37,14 @@ class TesterTools(object):
|
|
|
37
37
|
return SessionContext.instance().report_manager
|
|
38
38
|
|
|
39
39
|
@classmethod
|
|
40
|
-
def log(cls, msg):
|
|
40
|
+
def log(cls, msg, unlimited=False):
|
|
41
41
|
cls.__configure_logger()
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if unlimited:
|
|
44
|
+
logger.print(msg, msg_size_limit=-1)
|
|
45
|
+
else:
|
|
46
|
+
# logger.info(msg)
|
|
47
|
+
logger.print(msg)
|
|
45
48
|
|
|
46
49
|
@classmethod
|
|
47
50
|
def represent(cls, obj):
|
|
@@ -16,7 +16,7 @@ import logging
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
18
18
|
from holado_test.scenario.step_tools import StepTools
|
|
19
|
-
from holado_test.behave.behave import *
|
|
19
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
20
20
|
from holado_test.behave.behave import enter_expected_exception_step
|
|
21
21
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
22
22
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_core.common.block.function import Function
|
|
19
19
|
from holado_test.common.context.scenario_context import ScenarioContext
|
|
20
20
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|