1#!/usr/bin/env python3 2# coding=utf-8 3 4# 5# Copyright (c) 2020-2022 Huawei Device Co., Ltd. 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18 19import pkg_resources 20 21from .variables import Variables 22from _core.plugin import Plugin 23from _core.plugin import get_plugin 24from _core.logger import platform_logger 25from _core.interface import IDriver 26from _core.interface import IDevice 27from _core.interface import IDeviceManager 28from _core.interface import IParser 29from _core.interface import LifeCycle 30from _core.interface import IShellReceiver 31from _core.interface import ITestKit 32from _core.interface import IListener 33from _core.interface import IReporter 34from _core.exception import ParamError 35from _core.exception import DeviceError 36from _core.exception import LiteDeviceError 37from _core.exception import ExecuteTerminate 38from _core.exception import ReportException 39from _core.exception import HdcError 40from _core.exception import HdcCommandRejectedException 41from _core.exception import ShellCommandUnresponsiveException 42from _core.exception import DeviceUnresponsiveException 43from _core.exception import AppInstallError 44from _core.exception import HapNotSupportTest 45from _core.constants import DeviceTestType 46from _core.constants import DeviceLabelType 47from _core.constants import ManagerType 48from _core.constants import DeviceOsType 49from _core.constants import ProductForm 50from _core.constants import TestType 51from _core.constants import CKit 52from _core.constants import ConfigConst 53from _core.constants import ReportConst 54from _core.constants import ModeType 55from _core.constants import TestExecType 56from _core.constants import ListenerType 57from _core.constants import GTestConst 58from _core.constants import CommonParserType 59from _core.constants import FilePermission 60from _core.constants import HostDrivenTestType 61from _core.constants import DeviceConnectorType 62from _core.config.config_manager import UserConfigManager 63from _core.config.resource_manager import ResourceManager 64from _core.executor.listener import CaseResult 65from _core.executor.listener import SuiteResult 66from _core.executor.listener import SuitesResult 67from _core.executor.listener import StateRecorder 68from _core.executor.listener import TestDescription 69from _core.executor.listener import CollectingTestListener 70from _core.testkit.json_parser import JsonParser 71from _core.testkit.kit import junit_para_parse 72from _core.testkit.kit import gtest_para_parse 73from _core.testkit.kit import reset_junit_para 74from _core.testkit.kit import get_app_name_by_tool 75from _core.testkit.kit import get_install_args 76from _core.testkit.kit import remount 77from _core.testkit.kit import disable_keyguard 78from _core.testkit.kit import unlock_screen 79from _core.testkit.kit import unlock_device 80from _core.testkit.kit import get_class 81from _core.driver.parser_lite import ShellHandler 82from _core.report.encrypt import check_pub_key_exist 83from _core.utils import get_file_absolute_path 84from _core.utils import check_result_report 85from _core.utils import get_device_log_file 86from _core.utils import get_kit_instances 87from _core.utils import get_config_value 88from _core.utils import exec_cmd 89from _core.utils import check_device_name 90from _core.utils import do_module_kit_setup 91from _core.utils import do_module_kit_teardown 92from _core.utils import convert_serial 93from _core.utils import convert_ip 94from _core.utils import convert_port 95from _core.utils import check_mode 96from _core.utils import get_filename_extension 97from _core.utils import get_test_component_version 98from _core.utils import get_local_ip 99from _core.utils import create_dir 100from _core.utils import is_proc_running 101from _core.utils import check_path_legal 102from _core.utils import modify_props 103from _core.utils import get_shell_handler 104from _core.utils import get_decode 105from _core.utils import get_cst_time 106from _core.utils import get_device_proc_pid 107from _core.utils import start_standing_subprocess 108from _core.utils import stop_standing_subprocess 109from _core.logger import LogQueue 110from _core.environment.manager_env import DeviceSelectionOption 111from _core.environment.manager_env import EnvironmentManager 112from _core.environment.device_state import DeviceEvent 113from _core.environment.device_state import TestDeviceState 114from _core.environment.device_state import DeviceState 115from _core.environment.device_state import \ 116 handle_allocation_event 117from _core.environment.device_state import \ 118 DeviceAllocationState 119from _core.environment.device_monitor import DeviceStateListener 120from _core.environment.device_monitor import DeviceStateMonitor 121from _core.executor.scheduler import Scheduler 122from _core.report.suite_reporter import SuiteReporter 123from _core.report.suite_reporter import ResultCode 124from _core.report.reporter_helper import ExecInfo 125from _core.report.result_reporter import ResultReporter 126from _core.report.reporter_helper import DataHelper 127from _core.report.__main__ import main_report 128from _core.command.console import Console 129 130__all__ = [ 131 "Variables", 132 "Console", 133 "platform_logger", 134 "Plugin", 135 "get_plugin", 136 "IDriver", 137 "IDevice", 138 "IDeviceManager", 139 "IParser", 140 "LifeCycle", 141 "IShellReceiver", 142 "ITestKit", 143 "IListener", 144 "IReporter", 145 "ParamError", 146 "DeviceError", 147 "LiteDeviceError", 148 "ExecuteTerminate", 149 "ReportException", 150 "HdcError", 151 "HdcCommandRejectedException", 152 "ShellCommandUnresponsiveException", 153 "DeviceUnresponsiveException", 154 "AppInstallError", 155 "HapNotSupportTest", 156 "DeviceTestType", 157 "DeviceLabelType", 158 "ManagerType", 159 "DeviceOsType", 160 "ProductForm", 161 "TestType", 162 "CKit", 163 "ConfigConst", 164 "ReportConst", 165 "ModeType", 166 "TestExecType", 167 "ListenerType", 168 "GTestConst", 169 "CommonParserType", 170 "FilePermission", 171 "HostDrivenTestType", 172 "DeviceConnectorType", 173 "UserConfigManager", 174 "ResourceManager", 175 "CaseResult", 176 "SuiteResult", 177 "SuitesResult", 178 "StateRecorder", 179 "TestDescription", 180 "CollectingTestListener", 181 "Scheduler", 182 "SuiteReporter", 183 "DeviceSelectionOption", 184 "EnvironmentManager", 185 "DeviceEvent", 186 "TestDeviceState", 187 "DeviceState", 188 "handle_allocation_event", 189 "DeviceAllocationState", 190 "DeviceStateListener", 191 "DeviceStateMonitor", 192 "JsonParser", 193 "junit_para_parse", 194 "gtest_para_parse", 195 "reset_junit_para", 196 "get_app_name_by_tool", 197 "get_install_args", 198 "remount", 199 "disable_keyguard", 200 "unlock_screen", 201 "unlock_device", 202 "get_class", 203 "ShellHandler", 204 "ResultCode", 205 "check_pub_key_exist", 206 "check_result_report", 207 "get_file_absolute_path", 208 "get_device_log_file", 209 "get_kit_instances", 210 "get_config_value", 211 "exec_cmd", 212 "check_device_name", 213 "do_module_kit_setup", 214 "do_module_kit_teardown", 215 "convert_serial", 216 "convert_ip", 217 "convert_port", 218 "check_mode", 219 "get_filename_extension", 220 "get_test_component_version", 221 "get_local_ip", 222 "create_dir", 223 "is_proc_running", 224 "check_path_legal", 225 "modify_props", 226 "get_shell_handler", 227 "get_decode", 228 "get_cst_time", 229 "get_device_proc_pid", 230 "start_standing_subprocess", 231 "stop_standing_subprocess", 232 "ExecInfo", 233 "ResultReporter", 234 "DataHelper", 235 "main_report", 236 "LogQueue" 237] 238 239 240def _load_external_plugins(): 241 plugins = [Plugin.SCHEDULER, Plugin.DRIVER, Plugin.DEVICE, Plugin.LOG, 242 Plugin.PARSER, Plugin.LISTENER, Plugin.TEST_KIT, Plugin.MANAGER, 243 Plugin.REPORTER] 244 for plugin_group in plugins: 245 for entry_point in pkg_resources.iter_entry_points(group=plugin_group): 246 entry_point.load() 247 return 248 249 250_load_external_plugins() 251del _load_external_plugins 252