diff --git a/flybirds/cli/__main__.py b/flybirds/cli/__main__.py index 747c2c5e..0b70321f 100644 --- a/flybirds/cli/__main__.py +++ b/flybirds/cli/__main__.py @@ -65,7 +65,8 @@ def runner( ), processes: int = typer.Option( 4, "--processes", '-p', - help="Maximum number of processes. Default = 4" + help="Maximum number of processes. Default = 4. Effective when " + "test on web." ) ): """ diff --git a/flybirds/cli/create_project.py b/flybirds/cli/create_project.py index dc43de51..6e38751f 100644 --- a/flybirds/cli/create_project.py +++ b/flybirds/cli/create_project.py @@ -37,7 +37,7 @@ def create_demo(): "Please input your test platform?(Android/IOS/Web)" ) if test_platform is None or test_platform.strip().lower() not in [ - 'android', 'ios', 'web']: + 'android', 'ios', 'web']: test_platform = 'android' test_platform = test_platform.strip().lower() user_dict['test_platform'] = test_platform @@ -89,7 +89,7 @@ def create_demo(): "Please input your test browserType?(chromium/firefox/webkit)" ) if browser_type is None or browser_type.strip().lower() not in [ - 'chromium', 'firefox', 'webkit']: + 'chromium', 'firefox', 'webkit']: browser_type = 'chromium' browser_type = browser_type.strip().lower() user_dict['browser_type'] = browser_type diff --git a/flybirds/cli/parse_args.py b/flybirds/cli/parse_args.py index 1e0d124d..cd7f83c3 100644 --- a/flybirds/cli/parse_args.py +++ b/flybirds/cli/parse_args.py @@ -40,8 +40,8 @@ def parse_args( :return: """ log.info( - f"flybirds cmd info: {feature_path} {tag} {report_format} {report_path}" - f" {define} {rerun} {es} {to_html} {run_at}" + f"flybirds cmd info: {feature_path} {tag} {report_format} " + f"{report_path} {define} {rerun} {es} {to_html} {run_at}" ) check_workspace_args(feature_path) diff --git a/flybirds/core/config_manage.py b/flybirds/core/config_manage.py index 8ff508cd..885380ee 100644 --- a/flybirds/core/config_manage.py +++ b/flybirds/core/config_manage.py @@ -168,7 +168,7 @@ class WebConfig: def __init__(self, user_data, config): web_info = get_config(config, "web_info") if web_info is None: - log.warn(f'[web_info] configuration of web_info is none.') + log.warn('[web_info] configuration of web_info is none.') # default value self.headless = True self.browser_type = 'chromium' diff --git a/flybirds/core/plugin/plugins/default/__init__.py b/flybirds/core/plugin/plugins/default/__init__.py index 7995b018..e69de29b 100644 --- a/flybirds/core/plugin/plugins/default/__init__.py +++ b/flybirds/core/plugin/plugins/default/__init__.py @@ -1,2 +0,0 @@ -from .web.screen import Screen -from .web.screen_record import ScreenRecordInfo diff --git a/flybirds/core/plugin/plugins/default/android/step.py b/flybirds/core/plugin/plugins/default/android/step.py index 17ecda17..32990b57 100644 --- a/flybirds/core/plugin/plugins/default/android/step.py +++ b/flybirds/core/plugin/plugins/default/android/step.py @@ -5,8 +5,7 @@ from flybirds.core.plugin.plugins.default.app_base_step import AppBaseStep from flybirds.core.plugin.plugins.default.step.app \ - import (install_app, uninstall_app, to_app_home, app_login, app_logout, - return_pre_page) + import (install_app, uninstall_app, return_pre_page) from flybirds.core.plugin.plugins.default.step.schema import jump_to_page __open__ = ["Step"] @@ -23,15 +22,6 @@ def install_app(self, context, param): def uninstall_app(self, context, param): uninstall_app(context, param) - def to_app_home(self, context): - to_app_home(context) - - def app_login(self, context, param1, param2): - app_login(context, param1, param2) - - def app_logout(self, context): - app_logout(context) - def return_pre_page(self, context): return_pre_page(context) diff --git a/flybirds/core/plugin/plugins/default/app_base_step.py b/flybirds/core/plugin/plugins/default/app_base_step.py index 93a7b502..8b042b5f 100644 --- a/flybirds/core/plugin/plugins/default/app_base_step.py +++ b/flybirds/core/plugin/plugins/default/app_base_step.py @@ -6,10 +6,13 @@ import flybirds.core.plugin.plugins.default.step.attr as step_attr import flybirds.core.plugin.plugins.default.step.click as step_click import flybirds.core.plugin.plugins.default.step.common as step_common -import flybirds.core.plugin.plugins.default.step.page_show_adjust as step_adjust +import flybirds.core.plugin.plugins.default.step.page_show_adjust \ + as step_adjust import flybirds.core.plugin.plugins.default.step.record as step_record import flybirds.core.plugin.plugins.default.step.swipe as step_swipe import flybirds.core.plugin.plugins.default.step.verify as step_verify +from flybirds.core.plugin.plugins.default.step.app \ + import (to_app_home, app_login, app_logout) from flybirds.core.plugin.plugins.default.step.input import ele_input from flybirds.core.plugin.plugins.default.step.position import ( position_not_change @@ -116,3 +119,12 @@ def wait_ele_appear(self, context, param): def exist_ele(self, context, param): step_verify.exist_ele(context, param) + + def to_app_home(self, context): + to_app_home(context) + + def app_login(self, context, param1, param2): + app_login(context, param1, param2) + + def app_logout(self, context): + app_logout(context) diff --git a/flybirds/core/plugin/plugins/default/base_element.py b/flybirds/core/plugin/plugins/default/base_element.py index 32312b59..b69db848 100644 --- a/flybirds/core/plugin/plugins/default/base_element.py +++ b/flybirds/core/plugin/plugins/default/base_element.py @@ -6,8 +6,8 @@ import \ flybirds.core.plugin.plugins.default.ui_driver.poco.poco_attr as poco_attr -import \ - flybirds.core.plugin.plugins.default.ui_driver.poco.poco_click as poco_click +import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_click \ + as poco_click import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_ele as poco_ele import \ flybirds.core.plugin.plugins.default.ui_driver.poco.poco_findsnap \ @@ -18,8 +18,8 @@ import \ flybirds.core.plugin.plugins.default.ui_driver.poco.poco_selector \ as poco_selector -import \ - flybirds.core.plugin.plugins.default.ui_driver.poco.poco_swipe as poco_swipe +import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_swipe \ + as poco_swipe import \ flybirds.core.plugin.plugins.default.ui_driver.poco.poco_text as poco_text import \ diff --git a/flybirds/core/plugin/plugins/default/screen.py b/flybirds/core/plugin/plugins/default/screen.py index 51bf4fe9..ddebffe0 100644 --- a/flybirds/core/plugin/plugins/default/screen.py +++ b/flybirds/core/plugin/plugins/default/screen.py @@ -50,8 +50,8 @@ def screen_link_to_behave(scenario, step_index, tag=None): screenshot address and linked to the tag The label information is placed in the description of the scene, and the json report is processed after all the runs are finished, - and the information in the description is converted into embeddings - information in the step. + and the information in the description is converted into + embeddings information in the step. """ feature_name = file_helper.valid_file_name(scenario.feature.name) scenario_name = file_helper.valid_file_name(scenario.name) diff --git a/flybirds/core/plugin/plugins/default/screen_record.py b/flybirds/core/plugin/plugins/default/screen_record.py index d904bb2e..f335d590 100644 --- a/flybirds/core/plugin/plugins/default/screen_record.py +++ b/flybirds/core/plugin/plugins/default/screen_record.py @@ -115,10 +115,10 @@ def start_record(self, timeout, bit_rate_level=1, bit_rate=None): cmd = "{} -s {} shell screenrecord --bugreport " \ "--size {}x{} --time-limit {} --bit-rate {} " \ "--verbose sdcard/flybirds.mp4".format(airtest_adb_path, - device_id, - screen_size[0], - screen_size[1], - timeout, bit_rate) + device_id, + screen_size[0], + screen_size[1], + timeout, bit_rate) else: cmd = "{} -s {} shell screenrecord" \ " --size {}x{} " \ @@ -126,9 +126,9 @@ def start_record(self, timeout, bit_rate_level=1, bit_rate=None): "--bit-rate {}" \ " --verbose " \ "sdcard/flybirds.mp4".format(airtest_adb_path, device_id, - screen_size[0], - screen_size[1], timeout, - bit_rate) + screen_size[0], + screen_size[1], timeout, + bit_rate) proc = cmd_helper.create_sub_process(cmd) message = "" diff --git a/flybirds/core/plugin/plugins/default/step/click.py b/flybirds/core/plugin/plugins/default/step/click.py index 242bd19d..aef7bcd4 100644 --- a/flybirds/core/plugin/plugins/default/step/click.py +++ b/flybirds/core/plugin/plugins/default/step/click.py @@ -3,7 +3,8 @@ Step implement of element click. """ import flybirds.core.global_resource as gr -import flybirds.core.plugin.plugins.default.ui_driver.poco.findsnap as find_snap +import flybirds.core.plugin.plugins.default.ui_driver.poco.findsnap \ + as find_snap import flybirds.utils.dsl_helper as dsl_helper from flybirds.core.global_context import GlobalContext as g_Context diff --git a/flybirds/core/plugin/plugins/default/ui_driver/poco/parse_path.py b/flybirds/core/plugin/plugins/default/ui_driver/poco/parse_path.py index d0ebb488..2e1b1d01 100644 --- a/flybirds/core/plugin/plugins/default/ui_driver/poco/parse_path.py +++ b/flybirds/core/plugin/plugins/default/ui_driver/poco/parse_path.py @@ -2,7 +2,8 @@ """ Convert poco object """ -import flybirds.core.plugin.plugins.default.ui_driver.poco.parse_selector as msd +import flybirds.core.plugin.plugins.default.ui_driver.poco.parse_selector \ + as msd import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_selector as pc import flybirds.utils.snippet as snippet from flybirds.core.global_context import GlobalContext as g_Context diff --git a/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_ele.py b/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_ele.py index d929b20e..cf23384e 100644 --- a/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_ele.py +++ b/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_ele.py @@ -5,7 +5,8 @@ import time import flybirds.core.global_resource as gr -import flybirds.core.plugin.plugins.default.ui_driver.poco.findsnap as find_snap +import flybirds.core.plugin.plugins.default.ui_driver.poco.findsnap \ + as find_snap import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_manage as pm import flybirds.utils.flybirds_log as log from flybirds.core.exceptions import FlybirdEleExistsException diff --git a/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_manage.py b/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_manage.py index 6edce054..f667c5b4 100644 --- a/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_manage.py +++ b/flybirds/core/plugin/plugins/default/ui_driver/poco/poco_manage.py @@ -3,7 +3,8 @@ Poco manage api """ import flybirds.core.plugin.plugins.default.ui_driver.poco.parse_path as parse -import flybirds.core.plugin.plugins.default.ui_driver.poco.parse_selector as msd +import flybirds.core.plugin.plugins.default.ui_driver.poco.parse_selector \ + as msd import flybirds.core.plugin.plugins.default.ui_driver.poco.poco_selector as pc from flybirds.core.global_context import GlobalContext as g_context diff --git a/flybirds/core/plugin/plugins/default/web/element.py b/flybirds/core/plugin/plugins/default/web/element.py index b83ea718..661a5ca5 100644 --- a/flybirds/core/plugin/plugins/default/web/element.py +++ b/flybirds/core/plugin/plugins/default/web/element.py @@ -204,7 +204,7 @@ def ele_select(self, context, selector, option_str): log.info(f'[ele_select] select option[{option_str}] success.') except FlybirdsVerifyEleException as fe: raise fe - except Exception as e: + except Exception: # select by value log.warn(f'[ele_select] retry select option[{option_str}].') locator.select_option(option_str) diff --git a/flybirds/core/plugin/plugins/default/web/page.py b/flybirds/core/plugin/plugins/default/web/page.py index f47d3b1f..cda1f0ff 100644 --- a/flybirds/core/plugin/plugins/default/web/page.py +++ b/flybirds/core/plugin/plugins/default/web/page.py @@ -52,7 +52,7 @@ def sleep(self, context, param): if is_number(param): self.page.wait_for_timeout(float(param) * 1000) else: - log.warn(f"default wait for timeout!") + log.warn("default wait for timeout!") self.page.wait_for_timeout(3 * 1000) def cur_page_equal(self, context, param): diff --git a/flybirds/core/script_config.py b/flybirds/core/script_config.py index ea5fc71e..fe68ba74 100644 --- a/flybirds/core/script_config.py +++ b/flybirds/core/script_config.py @@ -38,4 +38,3 @@ def __init__(self): if os.path.exists(tag_provider_path): tag_provider_path_import_path = "tag_provider" self.tag_provider = __import__(tag_provider_path_import_path) - diff --git a/flybirds/report/fail_feature_create.py b/flybirds/report/fail_feature_create.py index 70071a37..d9ff09be 100644 --- a/flybirds/report/fail_feature_create.py +++ b/flybirds/report/fail_feature_create.py @@ -481,11 +481,7 @@ def failed_rerun(rerun_cmd_str: str, rerun_feature_path, processes, def parallel_rerun(rerun_cmd_str: str, rerun_feature_path, processes): - log.info(f'parallel_rerun start!') - log.info(f'[parallel_rerun] processes num: {processes}') - log.info(f'[parallel_rerun] rerun_feature_path: {rerun_feature_path}') - log.info(f'[parallel_rerun] rerun_cmd_str: \n\n{rerun_cmd_str}\n\n') - + log.info('parallel_rerun start!') dry_cmd = f'behave {rerun_feature_path} -d -k -f json --no-summary' features = get_features_num(dry_cmd) log.info(f'[parallel_rerun] features num: {len(features)}') diff --git a/flybirds/report/parallel_runner.py b/flybirds/report/parallel_runner.py index 9e0d30fd..d14055ed 100644 --- a/flybirds/report/parallel_runner.py +++ b/flybirds/report/parallel_runner.py @@ -75,7 +75,8 @@ def parallel_run(context): if parsed_tags and len(parsed_tags) > 0: # -k, --no-skipped - cmd = f'behave {feature_path} {" ".join(parsed_tags)} -d -k -f json --no-summary' + cmd = f'behave {feature_path} {" ".join(parsed_tags)} -d -k -f json ' \ + f'--no-summary' else: cmd = f'behave {feature_path} -d -k -f json --no-summary' features = get_features_num(cmd) diff --git a/flybirds/utils/file_helper.py b/flybirds/utils/file_helper.py index 01320705..4755348d 100644 --- a/flybirds/utils/file_helper.py +++ b/flybirds/utils/file_helper.py @@ -28,7 +28,7 @@ def get_json_from_file_path(path): f = open(path, "r", errors='ignore') json_str = f.read().strip().replace('\r\n', '\\r\\n') result = json.loads(json_str, strict=False) - except JSONDecodeError as e: + except JSONDecodeError: log.warn('get_json_from_file_path has error.') finally: if f: