• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.interface import IFilter
35from _core.exception import ParamError
36from _core.exception import DeviceError
37from _core.exception import LiteDeviceError
38from _core.exception import ExecuteTerminate
39from _core.exception import ReportException
40from _core.exception import HdcError
41from _core.exception import HdcCommandRejectedException
42from _core.exception import ShellCommandUnresponsiveException
43from _core.exception import DeviceUnresponsiveException
44from _core.exception import AppInstallError
45from _core.exception import HapNotSupportTest
46from _core.exception import RpcNotRunningError
47from _core.constants import DeviceTestType
48from _core.constants import DeviceLabelType
49from _core.constants import ManagerType
50from _core.constants import DeviceOsType
51from _core.constants import ProductForm
52from _core.constants import TestType
53from _core.constants import CKit
54from _core.constants import ConfigConst
55from _core.constants import ReportConst
56from _core.constants import ModeType
57from _core.constants import TestExecType
58from _core.constants import ListenerType
59from _core.constants import GTestConst
60from _core.constants import CommonParserType
61from _core.constants import FilePermission
62from _core.constants import HostDrivenTestType
63from _core.constants import DeviceConnectorType
64from _core.constants import DeviceProperties
65from _core.constants import AdvanceDeviceOption
66from _core.constants import LifeStage
67from _core.constants import Platform
68from _core.config.config_manager import UserConfigManager
69from _core.config.resource_manager import ResourceManager
70from _core.executor.listener import CaseResult
71from _core.executor.listener import SuiteResult
72from _core.executor.listener import SuitesResult
73from _core.executor.listener import StateRecorder
74from _core.executor.listener import TestDescription
75from _core.executor.listener import CollectingTestListener
76from _core.executor.request import Task
77from _core.testkit.json_parser import JsonParser
78from _core.testkit.kit import junit_para_parse
79from _core.testkit.kit import gtest_para_parse
80from _core.testkit.kit import reset_junit_para
81from _core.testkit.kit import get_app_name_by_tool
82from _core.testkit.kit import get_install_args
83from _core.testkit.kit import remount
84from _core.testkit.kit import disable_keyguard
85from _core.testkit.kit import unlock_screen
86from _core.testkit.kit import unlock_device
87from _core.testkit.kit import get_class
88from _core.driver.parser_lite import ShellHandler
89from _core.driver.parser_lite import driver_output_method
90from _core.report.encrypt import check_pub_key_exist
91from _core.utils import get_file_absolute_path
92from _core.utils import check_result_report
93from _core.utils import get_device_log_file
94from _core.utils import get_kit_instances
95from _core.utils import get_config_value
96from _core.utils import exec_cmd
97from _core.utils import check_device_name
98from _core.utils import do_module_kit_setup
99from _core.utils import do_module_kit_teardown
100from _core.utils import convert_serial
101from _core.utils import convert_ip
102from _core.utils import convert_port
103from _core.utils import convert_mac
104from _core.utils import check_mode
105from _core.utils import get_filename_extension
106from _core.utils import get_test_component_version
107from _core.utils import get_local_ip
108from _core.utils import create_dir
109from _core.utils import is_proc_running
110from _core.utils import check_path_legal
111from _core.utils import modify_props
112from _core.utils import get_shell_handler
113from _core.utils import get_decode
114from _core.utils import get_cst_time
115from _core.utils import get_delta_time_ms
116from _core.utils import get_netstat_proc_pid
117from _core.utils import calculate_elapsed_time
118from _core.utils import check_mode_in_sys
119from _core.utils import start_standing_subprocess
120from _core.utils import stop_standing_subprocess
121from _core.logger import LogQueue
122from _core.environment.manager_env import DeviceSelectionOption
123from _core.environment.manager_env import EnvironmentManager
124from _core.environment.env_pool import EnvPool
125from _core.environment.env_pool import XMLNode
126from _core.environment.env_pool import Selector
127from _core.environment.env_pool import DeviceNode
128from _core.environment.env_pool import DeviceSelector
129from _core.environment.env_pool import is_env_pool_run_mode
130from _core.environment.device_state import DeviceEvent
131from _core.environment.device_state import TestDeviceState
132from _core.environment.device_state import DeviceState
133from _core.environment.device_state import \
134    handle_allocation_event
135from _core.environment.device_state import \
136    DeviceAllocationState
137from _core.environment.device_monitor import DeviceStateListener
138from _core.environment.device_monitor import DeviceStateMonitor
139from _core.executor.scheduler import Scheduler
140from _core.report.suite_reporter import SuiteReporter
141from _core.report.suite_reporter import ResultCode
142from _core.report.reporter_helper import ExecInfo
143from _core.report.result_reporter import ResultReporter
144from _core.report.reporter_helper import DataHelper
145from _core.report.__main__ import main_report
146from _core.command.console import Console
147
148VERSION = "2.39.0.1042"
149
150__all__ = [
151    "VERSION",
152    "Variables",
153    "Console",
154    "platform_logger",
155    "Plugin",
156    "get_plugin",
157    "IDriver",
158    "IDevice",
159    "IDeviceManager",
160    "IParser",
161    "IFilter",
162    "LifeCycle",
163    "IShellReceiver",
164    "ITestKit",
165    "IListener",
166    "IReporter",
167    "ParamError",
168    "DeviceError",
169    "LiteDeviceError",
170    "ExecuteTerminate",
171    "ReportException",
172    "HdcError",
173    "HdcCommandRejectedException",
174    "ShellCommandUnresponsiveException",
175    "DeviceUnresponsiveException",
176    "AppInstallError",
177    "HapNotSupportTest",
178    "RpcNotRunningError",
179    "DeviceTestType",
180    "DeviceLabelType",
181    "ManagerType",
182    "DeviceOsType",
183    "ProductForm",
184    "TestType",
185    "CKit",
186    "ConfigConst",
187    "ReportConst",
188    "ModeType",
189    "TestExecType",
190    "ListenerType",
191    "GTestConst",
192    "CommonParserType",
193    "FilePermission",
194    "HostDrivenTestType",
195    "DeviceConnectorType",
196    "DeviceProperties",
197    "AdvanceDeviceOption",
198    "UserConfigManager",
199    "ResourceManager",
200    "CaseResult",
201    "SuiteResult",
202    "SuitesResult",
203    "StateRecorder",
204    "TestDescription",
205    "CollectingTestListener",
206    "Task",
207    "Scheduler",
208    "SuiteReporter",
209    "DeviceSelectionOption",
210    "EnvironmentManager",
211    "EnvPool",
212    "XMLNode",
213    "Selector",
214    "DeviceNode",
215    "DeviceSelector",
216    "is_env_pool_run_mode",
217    "DeviceEvent",
218    "TestDeviceState",
219    "DeviceState",
220    "handle_allocation_event",
221    "DeviceAllocationState",
222    "DeviceStateListener",
223    "DeviceStateMonitor",
224    "JsonParser",
225    "junit_para_parse",
226    "gtest_para_parse",
227    "reset_junit_para",
228    "get_app_name_by_tool",
229    "get_install_args",
230    "remount",
231    "disable_keyguard",
232    "unlock_screen",
233    "unlock_device",
234    "get_class",
235    "ShellHandler",
236    "driver_output_method",
237    "ResultCode",
238    "check_pub_key_exist",
239    "check_result_report",
240    "get_file_absolute_path",
241    "get_device_log_file",
242    "get_kit_instances",
243    "get_config_value",
244    "exec_cmd",
245    "check_device_name",
246    "do_module_kit_setup",
247    "do_module_kit_teardown",
248    "convert_serial",
249    "convert_ip",
250    "convert_port",
251    "convert_mac",
252    "check_mode",
253    "get_filename_extension",
254    "get_test_component_version",
255    "get_local_ip",
256    "create_dir",
257    "is_proc_running",
258    "check_path_legal",
259    "modify_props",
260    "get_shell_handler",
261    "get_decode",
262    "get_cst_time",
263    "get_delta_time_ms",
264    "get_netstat_proc_pid",
265    "calculate_elapsed_time",
266    "check_mode_in_sys",
267    "start_standing_subprocess",
268    "stop_standing_subprocess",
269    "ExecInfo",
270    "ResultReporter",
271    "DataHelper",
272    "main_report",
273    "LogQueue",
274    "LifeStage",
275    "Platform"
276]
277
278
279def _load_external_plugins():
280    plugins = [Plugin.SCHEDULER, Plugin.DRIVER, Plugin.DEVICE, Plugin.LOG,
281               Plugin.PARSER, Plugin.LISTENER, Plugin.TEST_KIT, Plugin.MANAGER,
282               Plugin.REPORTER]
283    for plugin_group in plugins:
284        for entry_point in pkg_resources.iter_entry_points(group=plugin_group):
285            entry_point.load()
286    return
287
288
289_load_external_plugins()
290del _load_external_plugins
291