codemie-test-harness 0.1.213__py3-none-any.whl → 0.1.214__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 codemie-test-harness might be problematic. Click here for more details.

@@ -4,21 +4,11 @@ import re
4
4
  import string
5
5
  import time
6
6
  import unicodedata
7
- from time import sleep
8
7
 
9
8
  from hamcrest import assert_that, equal_to, contains_string
10
9
 
11
10
  from codemie_sdk import CodeMieClient
12
- from codemie_sdk.exceptions import ApiError
13
- from codemie_sdk.models.workflow_state import (
14
- WorkflowExecutionState,
15
- WorkflowExecutionStatusEnum,
16
- )
17
- from codemie_sdk.services.workflow_execution_state import (
18
- WorkflowExecutionStateService,
19
- )
20
11
  from codemie_test_harness.tests import autotest_entity_prefix
21
- from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
22
12
 
23
13
 
24
14
  class BaseUtils:
@@ -47,29 +37,6 @@ def to_camel_case(input_string):
47
37
  return camel_case
48
38
 
49
39
 
50
- def wait_for_completion(
51
- execution_state_service: WorkflowExecutionStateService,
52
- state_id: str,
53
- timeout: int = int(CredentialsManager.get_parameter("DEFAULT_TIMEOUT", "120")),
54
- pool_interval: int = 3,
55
- ) -> WorkflowExecutionState:
56
- start_time = time.time()
57
- while time.time() - start_time < timeout:
58
- states = [row for row in execution_state_service.list() if row.id == state_id]
59
- if len(states) == 0:
60
- sleep(pool_interval)
61
- continue
62
- state = states[0]
63
- if state.status == WorkflowExecutionStatusEnum.SUCCEEDED:
64
- return state
65
- elif state.status == WorkflowExecutionStatusEnum.FAILED:
66
- raise ApiError(
67
- f"State execution failed: {execution_state_service.get_output(state_id)}"
68
- )
69
- sleep(pool_interval)
70
- raise TimeoutError("State was not executed within the timeout period.")
71
-
72
-
73
40
  def clean_json(json_str):
74
41
  try:
75
42
  # Attempt to parse the JSON string directly
@@ -3,9 +3,9 @@ from hamcrest import assert_that, greater_than_or_equal_to
3
3
 
4
4
  from codemie_test_harness.tests.utils.base_utils import (
5
5
  wait_for_entity,
6
- wait_for_completion,
7
6
  clean_json,
8
7
  )
8
+ from codemie_test_harness.tests.utils.workflow_utils import WorkflowUtils
9
9
 
10
10
 
11
11
  class SimilarityCheck:
@@ -27,7 +27,7 @@ class SimilarityCheck:
27
27
  lambda: states_service.list(),
28
28
  entity_name="similarity_analysis",
29
29
  )
30
- wait_for_completion(execution_state_service=states_service, state_id=state.id)
30
+ WorkflowUtils.wait_for_completion(service=states_service, _id=state.id)
31
31
  output = states_service.get_output(state_id=state.id).output
32
32
  output = int(clean_json(output).get("similarity_rank"))
33
33
  assert_that(
@@ -1,21 +1,37 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  from typing import Optional
4
+ import time
4
5
 
6
+
7
+ from codemie_sdk.exceptions import ApiError
5
8
  from codemie_sdk.models.workflow import (
6
9
  WorkflowCreateRequest,
7
10
  WorkflowUpdateRequest,
8
11
  WorkflowMode,
12
+ WorkflowExecution,
13
+ )
14
+ from codemie_sdk.models.workflow_state import (
15
+ WorkflowExecutionState,
16
+ WorkflowExecutionStatusEnum,
17
+ )
18
+ from codemie_sdk.services.workflow_execution import WorkflowExecutionService
19
+ from codemie_sdk.services.workflow_execution_state import WorkflowExecutionStateService
20
+
21
+ from codemie_test_harness.tests import (
22
+ PROJECT,
23
+ VERIFY_SSL,
24
+ API_DOMEN,
25
+ CredentialsManager,
9
26
  )
10
-
11
- from codemie_test_harness.tests import PROJECT, VERIFY_SSL, API_DOMEN
12
27
  from codemie_test_harness.tests.utils.base_utils import (
13
28
  BaseUtils,
14
29
  get_random_name,
15
30
  wait_for_entity,
16
- wait_for_completion,
17
31
  )
18
32
  from codemie_test_harness.tests.utils.http_utils import RequestHandler
33
+ from time import sleep
34
+
19
35
 
20
36
  workflow_endpoint = "/v1/workflows"
21
37
 
@@ -106,17 +122,21 @@ class WorkflowUtils(BaseUtils):
106
122
  file_name: Optional[str] = None,
107
123
  ):
108
124
  self.client.workflows.run(workflow, user_input=user_input, file_name=file_name)
109
- executions = self.client.workflows.executions(workflow)
125
+ executions_service = self.client.workflows.executions(workflow)
110
126
  execution_id = next(
111
- row.execution_id for row in executions.list() if row.prompt == user_input
127
+ row.execution_id
128
+ for row in executions_service.list()
129
+ if row.prompt == user_input
112
130
  )
113
- states_service = executions.states(execution_id)
131
+ states_service = executions_service.states(execution_id)
114
132
  state = wait_for_entity(
115
133
  lambda: states_service.list(),
116
134
  entity_name=execution_name,
117
135
  )
118
136
 
119
- wait_for_completion(execution_state_service=states_service, state_id=state.id)
137
+ self.wait_for_completion(service=states_service, _id=state.id)
138
+ self.wait_for_completion(service=executions_service, _id=execution_id)
139
+
120
140
  return states_service.get_output(state_id=state.id).output
121
141
 
122
142
  def run_workflow(self, workflow_id, user_input=""):
@@ -279,3 +299,39 @@ class WorkflowUtils(BaseUtils):
279
299
  process_thought(thought)
280
300
 
281
301
  return triggered_tools
302
+
303
+ @staticmethod
304
+ def wait_for_completion(
305
+ service: WorkflowExecutionStateService | WorkflowExecutionService,
306
+ _id: str,
307
+ timeout: int = int(CredentialsManager.get_parameter("DEFAULT_TIMEOUT", "120")),
308
+ pool_interval: int = 3,
309
+ ) -> WorkflowExecutionState | WorkflowExecution:
310
+ is_workflow_execution_state_state = isinstance(
311
+ service, WorkflowExecutionStateService
312
+ )
313
+ start_time = time.time()
314
+ while time.time() - start_time < timeout:
315
+ executions_or_states = [
316
+ row
317
+ for row in service.list()
318
+ if row.id == _id or row.execution_id == _id
319
+ ]
320
+ if len(executions_or_states) == 0:
321
+ sleep(pool_interval)
322
+ continue
323
+ execution_or_state = executions_or_states[0]
324
+ if execution_or_state.status == WorkflowExecutionStatusEnum.SUCCEEDED:
325
+ return execution_or_state
326
+ elif execution_or_state.status == WorkflowExecutionStatusEnum.FAILED:
327
+ if is_workflow_execution_state_state:
328
+ raise ApiError(f"State execution failed: {service.get_output(_id)}")
329
+ else:
330
+ raise ApiError(
331
+ f"Execution failed. Execution id: {execution_or_state.execution_id}"
332
+ )
333
+ sleep(pool_interval)
334
+ if is_workflow_execution_state_state:
335
+ raise TimeoutError("State was not executed within the timeout period.")
336
+ else:
337
+ raise TimeoutError("Workflow was not executed within the timeout period.")
@@ -54,7 +54,6 @@ class StateModel(BaseModel):
54
54
 
55
55
 
56
56
  class WorkflowYamlModel(BaseModel):
57
- enable_summarization_node: bool = False
58
57
  tools: List[ToolModel] = Field(default_factory=list)
59
58
  assistants: List[AssistantModel] = Field(default_factory=list)
60
59
  states: List[StateModel] = Field(default_factory=list)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codemie-test-harness
3
- Version: 0.1.213
3
+ Version: 0.1.214
4
4
  Summary: Autotest for CodeMie backend and UI
5
5
  Author: Anton Yeromin
6
6
  Author-email: anton_yeromin@epam.com
@@ -13,7 +13,7 @@ Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
13
13
  Requires-Dist: boto3 (>=1.39.8,<2.0.0)
14
14
  Requires-Dist: click (>=8.1.7,<9.0.0)
15
15
  Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
16
- Requires-Dist: codemie-sdk-python (==0.1.213)
16
+ Requires-Dist: codemie-sdk-python (==0.1.214)
17
17
  Requires-Dist: pytest (>=8.4.1,<9.0.0)
18
18
  Requires-Dist: pytest-playwright (>=0.7.0,<0.8.0)
19
19
  Requires-Dist: pytest-repeat (>=0.9.3,<0.10.0)
@@ -269,7 +269,7 @@ codemie_test_harness/tests/ui/workflows/test_workflows.py,sha256=zRBFiQYhJ_MWKGG
269
269
  codemie_test_harness/tests/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
270
270
  codemie_test_harness/tests/utils/assistant_utils.py,sha256=2s1MikCfIcM3UlkcuwaedyxI2hePuWT3h8F3SDjBCtk,8022
271
271
  codemie_test_harness/tests/utils/aws_parameters_store.py,sha256=YAVpvwElkKZJZvzSVxtOue1Gjs-kvSBS2y5QvIlz484,3267
272
- codemie_test_harness/tests/utils/base_utils.py,sha256=SJV-m8KuC6MAU4W5a1sWLz6Nw-1-buc0f-W1hbA1OIY,8270
272
+ codemie_test_harness/tests/utils/base_utils.py,sha256=MaYrJIQVmOYjqMIkfr7fJYgZQhnIlRr-3Xp2QlA1Ak0,7000
273
273
  codemie_test_harness/tests/utils/client_factory.py,sha256=xGta0ZaVYzWfwJ4cu3f89KkGc_R5Bq-9lqnhr57x_2w,972
274
274
  codemie_test_harness/tests/utils/confluence_utils.py,sha256=auhip1ntqSDsHWAoWCxQxfuNv05BinS6TWXyg_F2dfc,4544
275
275
  codemie_test_harness/tests/utils/constants.py,sha256=aGs0gdHB38Ozd-UyCKNpWRoQXMy3D0bjmfxiPcdZdqY,1165
@@ -290,11 +290,11 @@ codemie_test_harness/tests/utils/notification_utils.py,sha256=WyrO8Udp4O8-C4eI6w
290
290
  codemie_test_harness/tests/utils/provider_utils.py,sha256=NSI5vG1IPpzsytuwQAGbx9Fe0xN6OYQ9Gp9mvjO0H2g,5115
291
291
  codemie_test_harness/tests/utils/pytest_utils.py,sha256=k-mEjX2qpnh37sqKpJqYhZT6BV9974y_KaAhv8Xj9GI,284
292
292
  codemie_test_harness/tests/utils/search_utils.py,sha256=SrXiB2d9wiI5ka9bgg0CD73GOX_1mqi2Hz5FBm5DsEU,1435
293
- codemie_test_harness/tests/utils/similarity_check.py,sha256=1U66NGh6esISKABodtVobE2WnuFt0f6vcK3qUri6ZqU,1485
293
+ codemie_test_harness/tests/utils/similarity_check.py,sha256=2URqvD3Ft7efwLmhh2iYVsXrYboP9f-_B_ekZmJn0ac,1527
294
294
  codemie_test_harness/tests/utils/user_utils.py,sha256=zJNrmL3Fb7iGuaVRobUMwJ2Og6NqEPcM_9lw60m18T8,242
295
295
  codemie_test_harness/tests/utils/webhook_utils.py,sha256=YjyLwAqQjR12vYFOUmYhJCJIyZvKm4SvU-1oIjIYNqg,340
296
- codemie_test_harness/tests/utils/workflow_utils.py,sha256=d0dT5ciaLCDrRPZ-uwgGvWBhOdDExebH_h_Q3oJ4KOY,9261
297
- codemie_test_harness/tests/utils/yaml_utils.py,sha256=y9fUf4u4G4SoCktPOwaC5x71iaDKhktbz_XUfI9kNis,1661
296
+ codemie_test_harness/tests/utils/workflow_utils.py,sha256=tCSJ-6QyumveTP15ZiNzlkBgGxg97GcKV5Kkc02k_Zs,11409
297
+ codemie_test_harness/tests/utils/yaml_utils.py,sha256=iIdEl-rUUh1LgzAmD_mjfftthhvlzXyCuA37yBoH0Gw,1617
298
298
  codemie_test_harness/tests/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
299
299
  codemie_test_harness/tests/webhook/test_webhook_service.py,sha256=POmxQG0tpcNW9-yKQ62CcnQpUEFYlTOs0_4H9MijIHY,8127
300
300
  codemie_test_harness/tests/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -402,7 +402,7 @@ codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/__init__.
402
402
  codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py,sha256=D835gaRbCnB4va5mi9TdA_u9StSpGXQ_fgzwW0S2pwo,1173
403
403
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
404
404
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py,sha256=Se9imIiBYuJU78m1pLu0g4ZmHygKZjr6JjIWkGXTy1Q,1364
405
- codemie_test_harness-0.1.213.dist-info/METADATA,sha256=yFQaB6HKgMkLqmiIDGbo0-wu4bwEWhyGznZEIxz7FiI,27184
406
- codemie_test_harness-0.1.213.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
407
- codemie_test_harness-0.1.213.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
408
- codemie_test_harness-0.1.213.dist-info/RECORD,,
405
+ codemie_test_harness-0.1.214.dist-info/METADATA,sha256=P60BQniiZByraDIAxld3bYLAQ1l5dhPAk8OLFvxwKVs,27184
406
+ codemie_test_harness-0.1.214.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
407
+ codemie_test_harness-0.1.214.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
408
+ codemie_test_harness-0.1.214.dist-info/RECORD,,