PyBreeze 1.0.4__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.
- automation_ide/__init__.py +7 -0
- automation_ide/__main__.py +0 -0
- automation_ide/automation_editor_ui/__init__.py +0 -0
- automation_ide/automation_editor_ui/connect_gui/__init__.py +0 -0
- automation_ide/automation_editor_ui/connect_gui/ssh/__init__.py +0 -0
- automation_ide/automation_editor_ui/connect_gui/ssh/ssh_command_widget.py +246 -0
- automation_ide/automation_editor_ui/connect_gui/ssh/ssh_file_viewer_widget.py +501 -0
- automation_ide/automation_editor_ui/connect_gui/ssh/ssh_login_widget.py +67 -0
- automation_ide/automation_editor_ui/connect_gui/ssh/ssh_main_widget.py +49 -0
- automation_ide/automation_editor_ui/connect_gui/url/__init__.py +0 -0
- automation_ide/automation_editor_ui/connect_gui/url/ai_code_review_gui.py +177 -0
- automation_ide/automation_editor_ui/editor_main/__init__.py +0 -0
- automation_ide/automation_editor_ui/editor_main/main_ui.py +104 -0
- automation_ide/automation_editor_ui/extend_ai_gui/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/ai_gui_global_variable.py +40 -0
- automation_ide/automation_editor_ui/extend_ai_gui/code_review/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/code_review/code_review_thread.py +81 -0
- automation_ide/automation_editor_ui/extend_ai_gui/code_review/cot_code_review_gui.py +82 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/code_smell_detector.py +22 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/first_code_review.py +17 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/first_summary_prompt.py +17 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/global_rule.py +59 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/judge.py +91 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/judge_single_review.py +85 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/linter.py +17 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/step_by_step_analysis.py +35 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/total_summary.py +66 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_prompt_editor_widget.py +136 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_editor_widget.py +136 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/code_explainer.py +21 -0
- automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/code_review.py +37 -0
- automation_ide/automation_editor_ui/extend_ai_gui/skills/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_ai_gui/skills/skills_send_gui.py +98 -0
- automation_ide/automation_editor_ui/extend_multi_language/__init__.py +0 -0
- automation_ide/automation_editor_ui/extend_multi_language/extend_english.py +272 -0
- automation_ide/automation_editor_ui/extend_multi_language/extend_traditional_chinese.py +272 -0
- automation_ide/automation_editor_ui/extend_multi_language/update_language_dict.py +8 -0
- automation_ide/automation_editor_ui/menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/api_testka_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/api_testka_menu/build_api_testka_menu.py +137 -0
- automation_ide/automation_editor_ui/menu/automation_menu/auto_control_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/auto_control_menu/build_autocontrol_menu.py +169 -0
- automation_ide/automation_editor_ui/menu/automation_menu/automation_file_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/automation_file_menu/build_automation_file_menu.py +122 -0
- automation_ide/automation_editor_ui/menu/automation_menu/load_density_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/load_density_menu/build_load_density_menu.py +137 -0
- automation_ide/automation_editor_ui/menu/automation_menu/mail_thunder_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/mail_thunder_menu/build_mail_thunder_menu.py +88 -0
- automation_ide/automation_editor_ui/menu/automation_menu/test_pioneer_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/test_pioneer_menu/build_test_pioneer_menu.py +62 -0
- automation_ide/automation_editor_ui/menu/automation_menu/web_runner_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/automation_menu/web_runner_menu/build_webrunner_menu.py +119 -0
- automation_ide/automation_editor_ui/menu/build_menubar.py +47 -0
- automation_ide/automation_editor_ui/menu/install_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/install_menu/automation_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/install_menu/automation_menu/build_automation_install_menu.py +82 -0
- automation_ide/automation_editor_ui/menu/install_menu/install_utils.py +21 -0
- automation_ide/automation_editor_ui/menu/install_menu/tools_menu/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/install_menu/tools_menu/build_tool_install_menu.py +29 -0
- automation_ide/automation_editor_ui/menu/menu_utils.py +16 -0
- automation_ide/automation_editor_ui/menu/tools/__init__.py +0 -0
- automation_ide/automation_editor_ui/menu/tools/tools_menu.py +162 -0
- automation_ide/automation_editor_ui/show_code_window/__init__.py +0 -0
- automation_ide/automation_editor_ui/show_code_window/code_window.py +21 -0
- automation_ide/automation_editor_ui/syntax/__init__.py +0 -0
- automation_ide/automation_editor_ui/syntax/syntax_extend.py +40 -0
- automation_ide/automation_editor_ui/syntax/syntax_keyword.py +163 -0
- automation_ide/extend/__init__.py +0 -0
- automation_ide/extend/mail_thunder_extend/__init__.py +0 -0
- automation_ide/extend/mail_thunder_extend/mail_thunder_setting.py +36 -0
- automation_ide/extend/process_executor/__init__.py +0 -0
- automation_ide/extend/process_executor/api_testka/__init__.py +0 -0
- automation_ide/extend/process_executor/api_testka/api_testka_process.py +66 -0
- automation_ide/extend/process_executor/auto_control/__init__.py +0 -0
- automation_ide/extend/process_executor/auto_control/auto_control_process.py +62 -0
- automation_ide/extend/process_executor/file_automation/__init__.py +0 -0
- automation_ide/extend/process_executor/file_automation/file_automation_process.py +66 -0
- automation_ide/extend/process_executor/load_density/__init__.py +0 -0
- automation_ide/extend/process_executor/load_density/load_density_process.py +66 -0
- automation_ide/extend/process_executor/mail_thunder/__init__.py +0 -0
- automation_ide/extend/process_executor/mail_thunder/mail_thunder_process.py +16 -0
- automation_ide/extend/process_executor/process_executor_utils.py +72 -0
- automation_ide/extend/process_executor/python_task_process_manager.py +177 -0
- automation_ide/extend/process_executor/test_pioneer/__init__.py +0 -0
- automation_ide/extend/process_executor/test_pioneer/test_pioneer_process_manager.py +181 -0
- automation_ide/extend/process_executor/web_runner/__init__.py +0 -0
- automation_ide/extend/process_executor/web_runner/web_runner_process.py +66 -0
- automation_ide/utils/__init__.py +0 -0
- automation_ide/utils/exception/__init__.py +0 -0
- automation_ide/utils/exception/exception_tags.py +37 -0
- automation_ide/utils/exception/exceptions.py +50 -0
- automation_ide/utils/file_process/__init__.py +0 -0
- automation_ide/utils/file_process/get_dir_file_list.py +29 -0
- automation_ide/utils/json_format/__init__.py +1 -0
- automation_ide/utils/json_format/json_process.py +28 -0
- automation_ide/utils/logging/__init__.py +0 -0
- automation_ide/utils/logging/logger.py +50 -0
- automation_ide/utils/manager/__init__.py +0 -0
- automation_ide/utils/manager/package_manager/__init__.py +0 -0
- automation_ide/utils/manager/package_manager/package_manager_class.py +18 -0
- pybreeze-1.0.4.dist-info/METADATA +69 -0
- pybreeze-1.0.4.dist-info/RECORD +109 -0
- pybreeze-1.0.4.dist-info/WHEEL +5 -0
- pybreeze-1.0.4.dist-info/licenses/LICENSE +21 -0
- pybreeze-1.0.4.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
|
+
|
|
5
|
+
from automation_ide.extend.process_executor.process_executor_utils import build_process
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from automation_ide.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def call_file_automation_test(
|
|
15
|
+
main_window: AutomationEditor,
|
|
16
|
+
exec_str: Union[str, None] = None,
|
|
17
|
+
program_buffer: int = 1024000
|
|
18
|
+
):
|
|
19
|
+
build_process(main_window, "automation_file", exec_str, False, program_buffer)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def call_file_automation_test_with_send(
|
|
23
|
+
main_window: AutomationEditor,
|
|
24
|
+
exec_str: Union[str, None] = None,
|
|
25
|
+
program_buffer: int = 1024000
|
|
26
|
+
):
|
|
27
|
+
build_process(main_window, "automation_file", exec_str, True, program_buffer)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def call_file_automation_test_multi_file(
|
|
31
|
+
main_window: AutomationEditor,
|
|
32
|
+
program_buffer: int = 1024000
|
|
33
|
+
):
|
|
34
|
+
try:
|
|
35
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
36
|
+
if need_to_execute_list is not None \
|
|
37
|
+
and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0:
|
|
38
|
+
for execute_file in need_to_execute_list:
|
|
39
|
+
with open(execute_file, "r+") as test_script_json:
|
|
40
|
+
call_file_automation_test(
|
|
41
|
+
main_window,
|
|
42
|
+
test_script_json.read(),
|
|
43
|
+
program_buffer
|
|
44
|
+
)
|
|
45
|
+
except Exception as error:
|
|
46
|
+
print(repr(error), file=sys.stderr)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def call_file_automation_test_multi_file_and_send(
|
|
50
|
+
main_window: AutomationEditor,
|
|
51
|
+
program_buffer: int = 1024000
|
|
52
|
+
):
|
|
53
|
+
try:
|
|
54
|
+
|
|
55
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
56
|
+
if need_to_execute_list is not None \
|
|
57
|
+
and isinstance(need_to_execute_list, list) and len(need_to_execute_list) > 0:
|
|
58
|
+
for execute_file in need_to_execute_list:
|
|
59
|
+
with open(execute_file, "r+") as test_script_json:
|
|
60
|
+
call_file_automation_test_with_send(
|
|
61
|
+
main_window,
|
|
62
|
+
test_script_json.read(),
|
|
63
|
+
program_buffer
|
|
64
|
+
)
|
|
65
|
+
except Exception as error:
|
|
66
|
+
print(repr(error), file=sys.stderr)
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
|
+
|
|
5
|
+
from automation_ide.extend.process_executor.process_executor_utils import build_process
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from automation_ide.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def call_load_density(
|
|
15
|
+
main_window: AutomationEditor,
|
|
16
|
+
exec_str: Union[str, None] = None,
|
|
17
|
+
program_buffer: int = 1024000
|
|
18
|
+
):
|
|
19
|
+
build_process(main_window, "je_load_density", exec_str, False, program_buffer)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def call_load_density_with_send(
|
|
23
|
+
main_window: AutomationEditor,
|
|
24
|
+
exec_str: Union[str, None] = None,
|
|
25
|
+
program_buffer: int = 1024000
|
|
26
|
+
):
|
|
27
|
+
build_process(main_window, "je_load_density", exec_str, True, program_buffer)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def call_load_density_multi_file(
|
|
31
|
+
main_window: AutomationEditor,
|
|
32
|
+
program_buffer: int = 1024000
|
|
33
|
+
):
|
|
34
|
+
try:
|
|
35
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
36
|
+
if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(
|
|
37
|
+
need_to_execute_list) > 0:
|
|
38
|
+
for execute_file in need_to_execute_list:
|
|
39
|
+
with open(execute_file, "r+") as test_script_json:
|
|
40
|
+
call_load_density(
|
|
41
|
+
main_window,
|
|
42
|
+
test_script_json.read(),
|
|
43
|
+
program_buffer
|
|
44
|
+
)
|
|
45
|
+
except Exception as error:
|
|
46
|
+
print(repr(error), file=sys.stderr)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def call_load_density_multi_file_and_send(
|
|
50
|
+
main_window: AutomationEditor,
|
|
51
|
+
program_buffer: int = 1024000
|
|
52
|
+
):
|
|
53
|
+
try:
|
|
54
|
+
|
|
55
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
56
|
+
if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(
|
|
57
|
+
need_to_execute_list) > 0:
|
|
58
|
+
for execute_file in need_to_execute_list:
|
|
59
|
+
with open(execute_file, "r+") as test_script_json:
|
|
60
|
+
call_load_density_with_send(
|
|
61
|
+
main_window,
|
|
62
|
+
test_script_json.read(),
|
|
63
|
+
program_buffer
|
|
64
|
+
)
|
|
65
|
+
except Exception as error:
|
|
66
|
+
print(repr(error), file=sys.stderr)
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
|
+
|
|
5
|
+
from automation_ide.extend.process_executor.process_executor_utils import build_process
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def call_mail_thunder(
|
|
12
|
+
main_window: AutomationEditor,
|
|
13
|
+
exec_str: Union[str, None] = None,
|
|
14
|
+
program_buffer: int = 1024000
|
|
15
|
+
):
|
|
16
|
+
build_process(main_window, "je_mail_thunder", exec_str, False, program_buffer)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
from typing import TYPE_CHECKING, Union
|
|
6
|
+
|
|
7
|
+
from je_editor import EditorWidget
|
|
8
|
+
|
|
9
|
+
from automation_ide.automation_editor_ui.show_code_window.code_window import CodeWindow
|
|
10
|
+
from automation_ide.extend.mail_thunder_extend.mail_thunder_setting import send_after_test
|
|
11
|
+
from automation_ide.extend.process_executor.python_task_process_manager import TaskProcessManager
|
|
12
|
+
from automation_ide.utils.exception.exception_tags import wrong_test_data_format_exception_tag
|
|
13
|
+
from automation_ide.utils.exception.exceptions import ITETestExecutorException
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def build_process(
|
|
20
|
+
main_window: AutomationEditor,
|
|
21
|
+
package: str,
|
|
22
|
+
exec_str: Union[str, None] = None,
|
|
23
|
+
send_mail: bool = False,
|
|
24
|
+
program_buffer: int = 1024000,
|
|
25
|
+
):
|
|
26
|
+
try:
|
|
27
|
+
widget = main_window.tab_widget.currentWidget()
|
|
28
|
+
if isinstance(widget, EditorWidget) and exec_str is None:
|
|
29
|
+
test_format_code = widget.code_edit.toPlainText()
|
|
30
|
+
else:
|
|
31
|
+
test_format_code = exec_str
|
|
32
|
+
start_process(main_window, package, test_format_code, send_mail, program_buffer)
|
|
33
|
+
except json.decoder.JSONDecodeError as error:
|
|
34
|
+
print(
|
|
35
|
+
repr(error) +
|
|
36
|
+
"\n"
|
|
37
|
+
+ wrong_test_data_format_exception_tag,
|
|
38
|
+
file=sys.stderr
|
|
39
|
+
)
|
|
40
|
+
except ITETestExecutorException as error:
|
|
41
|
+
print(repr(error), file=sys.stderr)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def start_process(
|
|
45
|
+
main_window: AutomationEditor,
|
|
46
|
+
package: str,
|
|
47
|
+
test_format_code: str,
|
|
48
|
+
send_mail: bool = False,
|
|
49
|
+
program_buffer: int = 1024000
|
|
50
|
+
):
|
|
51
|
+
# Code window init
|
|
52
|
+
code_window = CodeWindow()
|
|
53
|
+
main_window.current_run_code_window.append(code_window)
|
|
54
|
+
main_window.clear_code_result()
|
|
55
|
+
# Process init
|
|
56
|
+
if send_mail:
|
|
57
|
+
process = TaskProcessManager(
|
|
58
|
+
main_window=code_window,
|
|
59
|
+
program_buffer_size=program_buffer,
|
|
60
|
+
program_encoding=main_window.encoding
|
|
61
|
+
)
|
|
62
|
+
else:
|
|
63
|
+
process = TaskProcessManager(
|
|
64
|
+
code_window,
|
|
65
|
+
task_done_trigger_function=send_after_test,
|
|
66
|
+
program_buffer_size=program_buffer,
|
|
67
|
+
program_encoding=main_window.encoding
|
|
68
|
+
)
|
|
69
|
+
process.start_test_process(
|
|
70
|
+
package,
|
|
71
|
+
exec_str=test_format_code,
|
|
72
|
+
)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import queue
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import threading
|
|
6
|
+
import typing
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from queue import Queue
|
|
9
|
+
from threading import Thread
|
|
10
|
+
from typing import Union
|
|
11
|
+
|
|
12
|
+
from PySide6.QtCore import QTimer
|
|
13
|
+
from PySide6.QtGui import QTextCharFormat
|
|
14
|
+
from je_editor.pyside_ui.main_ui.save_settings.user_color_setting_file import actually_color_dict
|
|
15
|
+
from je_editor.utils.venv_check.check_venv import check_and_choose_venv
|
|
16
|
+
|
|
17
|
+
from automation_ide.automation_editor_ui.show_code_window.code_window import CodeWindow
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class TaskProcessManager(object):
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
main_window: CodeWindow,
|
|
24
|
+
task_done_trigger_function: typing.Callable = None,
|
|
25
|
+
error_trigger_function: typing.Callable = None,
|
|
26
|
+
program_buffer_size: int = 1024,
|
|
27
|
+
program_encoding: str = "utf-8"
|
|
28
|
+
):
|
|
29
|
+
super().__init__()
|
|
30
|
+
self.compiler_path = None
|
|
31
|
+
# ite_instance param
|
|
32
|
+
self.read_program_error_output_from_thread: Union[threading.Thread, None] = None
|
|
33
|
+
self.read_program_output_from_thread: Union[threading.Thread, None] = None
|
|
34
|
+
self.main_window: CodeWindow = main_window
|
|
35
|
+
self.timer: QTimer = QTimer(self.main_window)
|
|
36
|
+
self.still_run_program: bool = True
|
|
37
|
+
self.program_encoding: str = program_encoding
|
|
38
|
+
self.run_output_queue: Queue = Queue()
|
|
39
|
+
self.run_error_queue: Queue = Queue()
|
|
40
|
+
self.process: Union[subprocess.Popen, None] = None
|
|
41
|
+
|
|
42
|
+
self.task_done_trigger_function: typing.Callable = task_done_trigger_function
|
|
43
|
+
self.error_trigger_function: typing.Callable = error_trigger_function
|
|
44
|
+
self.program_buffer_size = program_buffer_size
|
|
45
|
+
|
|
46
|
+
def renew_path(self) -> None:
|
|
47
|
+
if self.main_window.python_compiler is None:
|
|
48
|
+
# Renew compiler path
|
|
49
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
|
50
|
+
venv_path = Path(str(Path.cwd()) + "/venv/Scripts")
|
|
51
|
+
else:
|
|
52
|
+
venv_path = Path(str(Path.cwd()) + "/venv/bin")
|
|
53
|
+
self.compiler_path = check_and_choose_venv(venv_path)
|
|
54
|
+
else:
|
|
55
|
+
self.compiler_path = self.main_window.python_compiler
|
|
56
|
+
|
|
57
|
+
def start_test_process(self, package: str, exec_str: str):
|
|
58
|
+
self.renew_path()
|
|
59
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
|
60
|
+
exec_str = json.dumps(exec_str)
|
|
61
|
+
args = [
|
|
62
|
+
self.compiler_path,
|
|
63
|
+
"-m",
|
|
64
|
+
package,
|
|
65
|
+
"--execute_str",
|
|
66
|
+
exec_str
|
|
67
|
+
]
|
|
68
|
+
else:
|
|
69
|
+
args = " ".join([f"{self.compiler_path}", f"-m {package}", "--execute_str", f"{exec_str}"])
|
|
70
|
+
self.process: subprocess.Popen = subprocess.Popen(
|
|
71
|
+
args,
|
|
72
|
+
stdin=subprocess.PIPE,
|
|
73
|
+
stdout=subprocess.PIPE,
|
|
74
|
+
stderr=subprocess.PIPE,
|
|
75
|
+
shell=True,
|
|
76
|
+
encoding=self.program_encoding
|
|
77
|
+
)
|
|
78
|
+
self.still_run_program = True
|
|
79
|
+
# program output message queue thread
|
|
80
|
+
self.read_program_output_from_thread = Thread(
|
|
81
|
+
target=self.read_program_output_from_process,
|
|
82
|
+
daemon=True
|
|
83
|
+
)
|
|
84
|
+
self.read_program_output_from_thread.start()
|
|
85
|
+
# program error message queue thread
|
|
86
|
+
self.read_program_error_output_from_thread = Thread(
|
|
87
|
+
target=self.read_program_error_output_from_process,
|
|
88
|
+
daemon=True
|
|
89
|
+
)
|
|
90
|
+
self.read_program_error_output_from_thread.start()
|
|
91
|
+
# start Pyside update
|
|
92
|
+
# start timer
|
|
93
|
+
self.main_window.setWindowTitle(package)
|
|
94
|
+
self.main_window.show()
|
|
95
|
+
self.timer = QTimer()
|
|
96
|
+
self.timer.setInterval(100)
|
|
97
|
+
self.timer.timeout.connect(self.pull_text)
|
|
98
|
+
self.timer.start()
|
|
99
|
+
|
|
100
|
+
# Pyside UI update method
|
|
101
|
+
def pull_text(self):
|
|
102
|
+
try:
|
|
103
|
+
if not self.run_output_queue.empty():
|
|
104
|
+
output_message = self.run_output_queue.get_nowait()
|
|
105
|
+
output_message = str(output_message).strip()
|
|
106
|
+
if output_message:
|
|
107
|
+
text_cursor = self.main_window.code_result.textCursor()
|
|
108
|
+
text_format = QTextCharFormat()
|
|
109
|
+
text_format.setForeground(actually_color_dict.get("normal_output_color"))
|
|
110
|
+
text_cursor.insertText(output_message, text_format)
|
|
111
|
+
text_cursor.insertBlock()
|
|
112
|
+
if not self.run_error_queue.empty():
|
|
113
|
+
error_message = self.run_error_queue.get_nowait()
|
|
114
|
+
error_message = str(error_message).strip()
|
|
115
|
+
if error_message:
|
|
116
|
+
text_cursor = self.main_window.code_result.textCursor()
|
|
117
|
+
text_format = QTextCharFormat()
|
|
118
|
+
text_format.setForeground(actually_color_dict.get("error_output_color"))
|
|
119
|
+
text_cursor.insertText(error_message, text_format)
|
|
120
|
+
text_cursor.insertBlock()
|
|
121
|
+
except queue.Empty:
|
|
122
|
+
pass
|
|
123
|
+
if self.process is not None:
|
|
124
|
+
if self.process.returncode == 0:
|
|
125
|
+
if self.timer.isActive():
|
|
126
|
+
self.timer.stop()
|
|
127
|
+
self.exit_program()
|
|
128
|
+
elif self.process.returncode is not None:
|
|
129
|
+
if self.timer.isActive():
|
|
130
|
+
self.timer.stop()
|
|
131
|
+
self.exit_program()
|
|
132
|
+
if self.still_run_program:
|
|
133
|
+
# poll return code
|
|
134
|
+
self.process.poll()
|
|
135
|
+
else:
|
|
136
|
+
if self.timer.isActive():
|
|
137
|
+
self.timer.stop()
|
|
138
|
+
|
|
139
|
+
# exit program change run flag to false and clean read thread and queue and process
|
|
140
|
+
def exit_program(self):
|
|
141
|
+
self.still_run_program = False
|
|
142
|
+
if self.read_program_output_from_thread is not None:
|
|
143
|
+
self.read_program_output_from_thread = None
|
|
144
|
+
if self.read_program_error_output_from_thread is not None:
|
|
145
|
+
self.read_program_error_output_from_thread = None
|
|
146
|
+
self.print_and_clear_queue()
|
|
147
|
+
if self.process is not None:
|
|
148
|
+
self.process.terminate()
|
|
149
|
+
text_cursor = self.main_window.code_result.textCursor()
|
|
150
|
+
text_format = QTextCharFormat()
|
|
151
|
+
text_format.setForeground(actually_color_dict.get("normal_output_color"))
|
|
152
|
+
text_cursor.insertText(f"Task exit with code {self.process.returncode}", text_format)
|
|
153
|
+
text_cursor.insertBlock()
|
|
154
|
+
self.process = None
|
|
155
|
+
|
|
156
|
+
def print_and_clear_queue(self):
|
|
157
|
+
self.run_output_queue = queue.Queue()
|
|
158
|
+
self.run_error_queue = queue.Queue()
|
|
159
|
+
|
|
160
|
+
def read_program_output_from_process(self):
|
|
161
|
+
while self.still_run_program:
|
|
162
|
+
self.process: subprocess.Popen
|
|
163
|
+
program_output_data = self.process.stdout.readline(self.program_buffer_size) \
|
|
164
|
+
.decode("utf-8", "replace")
|
|
165
|
+
if self.process:
|
|
166
|
+
self.process.stdout.flush()
|
|
167
|
+
if program_output_data.strip() != "":
|
|
168
|
+
self.run_output_queue.put(program_output_data)
|
|
169
|
+
|
|
170
|
+
def read_program_error_output_from_process(self):
|
|
171
|
+
while self.still_run_program:
|
|
172
|
+
program_error_output_data = self.process.stderr.readline(self.program_buffer_size) \
|
|
173
|
+
.decode("utf-8", "replace")
|
|
174
|
+
if self.process:
|
|
175
|
+
self.process.stderr.flush()
|
|
176
|
+
if program_error_output_data.strip() != "":
|
|
177
|
+
self.run_error_queue.put(program_error_output_data)
|
|
File without changes
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import queue
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
import threading
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from queue import Queue
|
|
9
|
+
from typing import TYPE_CHECKING, Union
|
|
10
|
+
|
|
11
|
+
from PySide6.QtCore import QTimer
|
|
12
|
+
from PySide6.QtGui import QTextCharFormat
|
|
13
|
+
from PySide6.QtWidgets import QWidget
|
|
14
|
+
from je_editor.pyside_ui.main_ui.save_settings.user_color_setting_file import actually_color_dict
|
|
15
|
+
from je_editor.utils.venv_check.check_venv import check_and_choose_venv
|
|
16
|
+
|
|
17
|
+
from automation_ide.automation_editor_ui.show_code_window.code_window import CodeWindow
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestPioneerProcess(object):
|
|
24
|
+
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
main_window: AutomationEditor,
|
|
28
|
+
executable_path: str,
|
|
29
|
+
program_buffer: int = 1024000,
|
|
30
|
+
encoding: str = "utf-8",
|
|
31
|
+
):
|
|
32
|
+
self._main_window: AutomationEditor = main_window
|
|
33
|
+
self._widget: QWidget = main_window.tab_widget.currentWidget()
|
|
34
|
+
# Code window init
|
|
35
|
+
self._code_window = CodeWindow()
|
|
36
|
+
self._main_window.current_run_code_window.append(self._code_window)
|
|
37
|
+
self._main_window.clear_code_result()
|
|
38
|
+
self._still_run_program: bool = False
|
|
39
|
+
self._program_buffer_size = program_buffer
|
|
40
|
+
self._run_output_queue: Queue = Queue()
|
|
41
|
+
self._run_error_queue: Queue = Queue()
|
|
42
|
+
self._read_program_error_output_from_thread: Union[threading.Thread, None] = None
|
|
43
|
+
self._read_program_output_from_thread: Union[threading.Thread, None] = None
|
|
44
|
+
self._timer: QTimer = QTimer(self._code_window)
|
|
45
|
+
if self._main_window.python_compiler is None:
|
|
46
|
+
# Renew compiler path
|
|
47
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
|
48
|
+
venv_path = Path(str(Path.cwd()) + "/venv/Scripts")
|
|
49
|
+
else:
|
|
50
|
+
venv_path = Path(str(Path.cwd()) + "/venv/bin")
|
|
51
|
+
self._compiler_path = check_and_choose_venv(venv_path)
|
|
52
|
+
else:
|
|
53
|
+
self._compiler_path = main_window.python_compiler
|
|
54
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
|
55
|
+
args = [
|
|
56
|
+
self._compiler_path,
|
|
57
|
+
"-m",
|
|
58
|
+
"test_pioneer",
|
|
59
|
+
"-e",
|
|
60
|
+
executable_path
|
|
61
|
+
]
|
|
62
|
+
else:
|
|
63
|
+
args = " ".join([
|
|
64
|
+
f"{self._compiler_path}", "-m test_pioneer", "-e", f"{executable_path}"
|
|
65
|
+
])
|
|
66
|
+
self._process: subprocess.Popen = subprocess.Popen(
|
|
67
|
+
args,
|
|
68
|
+
stdin=subprocess.PIPE,
|
|
69
|
+
stdout=subprocess.PIPE,
|
|
70
|
+
stderr=subprocess.PIPE,
|
|
71
|
+
shell=True,
|
|
72
|
+
encoding=encoding
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Pyside UI update method
|
|
76
|
+
def pull_text(self):
|
|
77
|
+
try:
|
|
78
|
+
if not self._run_output_queue.empty():
|
|
79
|
+
output_message = self._run_output_queue.get_nowait()
|
|
80
|
+
output_message = str(output_message).strip()
|
|
81
|
+
if output_message:
|
|
82
|
+
text_cursor = self._code_window.code_result.textCursor()
|
|
83
|
+
text_format = QTextCharFormat()
|
|
84
|
+
text_format.setForeground(actually_color_dict.get("normal_output_color"))
|
|
85
|
+
text_cursor.insertText(output_message, text_format)
|
|
86
|
+
text_cursor.insertBlock()
|
|
87
|
+
if not self._run_error_queue.empty():
|
|
88
|
+
error_message = self._run_error_queue.get_nowait()
|
|
89
|
+
error_message = str(error_message).strip()
|
|
90
|
+
if error_message:
|
|
91
|
+
text_cursor = self._code_window.code_result.textCursor()
|
|
92
|
+
text_format = QTextCharFormat()
|
|
93
|
+
text_format.setForeground(actually_color_dict.get("error_output_color"))
|
|
94
|
+
text_cursor.insertText(error_message, text_format)
|
|
95
|
+
text_cursor.insertBlock()
|
|
96
|
+
except queue.Empty:
|
|
97
|
+
pass
|
|
98
|
+
if self._process is not None:
|
|
99
|
+
if self._process.returncode == 0:
|
|
100
|
+
if self._timer.isActive():
|
|
101
|
+
self._timer.stop()
|
|
102
|
+
self.exit_program()
|
|
103
|
+
elif self._process.returncode is not None:
|
|
104
|
+
if self._timer.isActive():
|
|
105
|
+
self._timer.stop()
|
|
106
|
+
self.exit_program()
|
|
107
|
+
if self._still_run_program:
|
|
108
|
+
# poll return code
|
|
109
|
+
self._process.poll()
|
|
110
|
+
else:
|
|
111
|
+
if self._timer.isActive():
|
|
112
|
+
self._timer.stop()
|
|
113
|
+
|
|
114
|
+
# exit program change run flag to false and clean read thread and queue and process
|
|
115
|
+
def exit_program(self):
|
|
116
|
+
self._still_run_program = False
|
|
117
|
+
if self._read_program_output_from_thread is not None:
|
|
118
|
+
self._read_program_output_from_thread = None
|
|
119
|
+
if self._read_program_error_output_from_thread is not None:
|
|
120
|
+
self._read_program_error_output_from_thread = None
|
|
121
|
+
self.print_and_clear_queue()
|
|
122
|
+
if self._process is not None:
|
|
123
|
+
self._process.terminate()
|
|
124
|
+
text_cursor = self._code_window.code_result.textCursor()
|
|
125
|
+
text_format = QTextCharFormat()
|
|
126
|
+
text_format.setForeground(actually_color_dict.get("normal_output_color"))
|
|
127
|
+
text_cursor.insertText(f"Task exit with code {self._process.returncode}", text_format)
|
|
128
|
+
text_cursor.insertBlock()
|
|
129
|
+
self._process = None
|
|
130
|
+
|
|
131
|
+
def print_and_clear_queue(self):
|
|
132
|
+
self._run_output_queue = queue.Queue()
|
|
133
|
+
self._run_error_queue = queue.Queue()
|
|
134
|
+
|
|
135
|
+
def read_program_output_from_process(self):
|
|
136
|
+
while self._still_run_program:
|
|
137
|
+
self.process: subprocess.Popen
|
|
138
|
+
program_output_data = self._process.stdout.readline(self._program_buffer_size) \
|
|
139
|
+
.decode("utf-8", "replace")
|
|
140
|
+
if self._process:
|
|
141
|
+
self._process.stdout.flush()
|
|
142
|
+
if program_output_data.strip() != "":
|
|
143
|
+
self._run_output_queue.put(program_output_data)
|
|
144
|
+
|
|
145
|
+
def read_program_error_output_from_process(self):
|
|
146
|
+
while self._still_run_program:
|
|
147
|
+
program_error_output_data = self._process.stderr.readline(self._program_buffer_size) \
|
|
148
|
+
.decode("utf-8", "replace")
|
|
149
|
+
if self._process:
|
|
150
|
+
self._process.stderr.flush()
|
|
151
|
+
if program_error_output_data.strip() != "":
|
|
152
|
+
self._run_error_queue.put(program_error_output_data)
|
|
153
|
+
|
|
154
|
+
def start_test_pioneer_process(self):
|
|
155
|
+
self._still_run_program = True
|
|
156
|
+
# program output message queue thread
|
|
157
|
+
self._read_program_output_from_thread = threading.Thread(
|
|
158
|
+
target=self.read_program_output_from_process,
|
|
159
|
+
daemon=True
|
|
160
|
+
)
|
|
161
|
+
self._read_program_output_from_thread.start()
|
|
162
|
+
# program error message queue thread
|
|
163
|
+
self._read_program_error_output_from_thread = threading.Thread(
|
|
164
|
+
target=self.read_program_error_output_from_process,
|
|
165
|
+
daemon=True
|
|
166
|
+
)
|
|
167
|
+
self._read_program_error_output_from_thread.start()
|
|
168
|
+
# start Pyside update
|
|
169
|
+
# start timer
|
|
170
|
+
self._code_window.setWindowTitle("Test Pioneer")
|
|
171
|
+
self._code_window.show()
|
|
172
|
+
self._timer = QTimer()
|
|
173
|
+
self._timer.setInterval(100)
|
|
174
|
+
self._timer.timeout.connect(self.pull_text)
|
|
175
|
+
self._timer.start()
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def init_and_start_test_pioneer_process(ui_we_want_to_set: AutomationEditor, file_path: str):
|
|
179
|
+
test_pioneer_process_manager = TestPioneerProcess(
|
|
180
|
+
main_window=ui_we_want_to_set, executable_path=file_path)
|
|
181
|
+
test_pioneer_process_manager.start_test_pioneer_process()
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
|
+
|
|
5
|
+
from automation_ide.extend.process_executor.process_executor_utils import build_process
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from automation_ide.utils.file_process.get_dir_file_list import ask_and_get_dir_files_as_list
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def call_web_runner_test(
|
|
15
|
+
main_window: AutomationEditor,
|
|
16
|
+
exec_str: Union[str, None] = None,
|
|
17
|
+
program_buffer: int = 1024000
|
|
18
|
+
):
|
|
19
|
+
build_process(main_window, "je_web_runner", exec_str, False, program_buffer)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def call_web_runner_test_with_send(
|
|
23
|
+
main_window: AutomationEditor,
|
|
24
|
+
exec_str: Union[str, None] = None,
|
|
25
|
+
program_buffer: int = 1024000
|
|
26
|
+
):
|
|
27
|
+
build_process(main_window, "je_web_runner", exec_str, True, program_buffer)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def call_web_runner_test_multi_file(
|
|
31
|
+
main_window: AutomationEditor,
|
|
32
|
+
program_buffer: int = 1024000
|
|
33
|
+
):
|
|
34
|
+
try:
|
|
35
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
36
|
+
if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(
|
|
37
|
+
need_to_execute_list) > 0:
|
|
38
|
+
for execute_file in need_to_execute_list:
|
|
39
|
+
with open(execute_file, "r+") as test_script_json:
|
|
40
|
+
call_web_runner_test(
|
|
41
|
+
main_window,
|
|
42
|
+
test_script_json.read(),
|
|
43
|
+
program_buffer
|
|
44
|
+
)
|
|
45
|
+
except Exception as error:
|
|
46
|
+
print(repr(error), file=sys.stderr)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def call_web_runner_test_multi_file_and_send(
|
|
50
|
+
main_window: AutomationEditor,
|
|
51
|
+
program_buffer: int = 1024000
|
|
52
|
+
):
|
|
53
|
+
try:
|
|
54
|
+
|
|
55
|
+
need_to_execute_list: list = ask_and_get_dir_files_as_list(main_window)
|
|
56
|
+
if need_to_execute_list is not None and isinstance(need_to_execute_list, list) and len(
|
|
57
|
+
need_to_execute_list) > 0:
|
|
58
|
+
for execute_file in need_to_execute_list:
|
|
59
|
+
with open(execute_file, "r+") as test_script_json:
|
|
60
|
+
call_web_runner_test_with_send(
|
|
61
|
+
main_window,
|
|
62
|
+
test_script_json.read(),
|
|
63
|
+
program_buffer
|
|
64
|
+
)
|
|
65
|
+
except Exception as error:
|
|
66
|
+
print(repr(error), file=sys.stderr)
|
|
File without changes
|
|
File without changes
|