Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control_dev",
version="0.0.27",
version="0.0.28",
author="JE-Chen",
author_email="zenmailman@gmail.com",
description="auto testing",
Expand Down
31 changes: 17 additions & 14 deletions je_auto_control/utils/executor/action_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ def __init__(self):
"generate_html": generate_html,
}

def execute_action(self, action_list: list) -> str:
def _execute_event(self, action: list):
event = self.event_dict.get(action[0])
if len(action) == 2:
event(**action[1])
elif len(action) == 1:
event()
else:
raise AutoControlActionException(cant_execute_action_error)

def execute_action(self, action_list: list) -> dict:
"""
use to execute all action on action list(action file or program list)
:param action_list the list include action
for loop the list and execute action
"""
execute_record_string = ""

execute_record_dict = dict()
try:
if len(action_list) > 0 or type(action_list) is list:
pass
Expand All @@ -69,20 +79,13 @@ def execute_action(self, action_list: list) -> str:
print(repr(error), file=sys.stderr)
for action in action_list:
try:
event = self.event_dict.get(action[0])
if len(action) == 2:
event(**action[1])
elif len(action) == 1:
event()
else:
raise AutoControlActionException(cant_execute_action_error)
event_response = self._execute_event(action)
execute_record = "execute: " + str(action)
execute_record_dict.update({execute_record: event_response})
except Exception as error:
print(repr(error), file=sys.stderr)
record_action_to_list("execute_action", None, repr(error))
temp_string = "execute: " + str(action)
print(temp_string)
execute_record_string = "".join([execute_record_string, temp_string + "\n"])
return execute_record_string
return execute_record_dict

def execute_files(self, execute_files_list: list) -> list:
"""
Expand All @@ -106,7 +109,7 @@ def add_command_to_executor(command_dict: dict):
raise AutoControlAddCommandException(add_command_exception_tag)


def execute_action(action_list: list) -> str:
def execute_action(action_list: list) -> dict:
return executor.execute_action(action_list)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control",
version="0.0.94",
version="0.0.95",
author="JE-Chen",
author_email="zenmailman@gmail.com",
description="auto testing",
Expand Down
2 changes: 1 addition & 1 deletion test/unit_test/execute_action/execute_action_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
["type_key", {"mouse_keycode": "dwadwawda", "dwadwad": 500, "wdawddwawad": 500}],
]
print("\n\n")
execute_action(test_list)
print(execute_action(test_list))
print(test_record_instance.test_record_list)