From c51c6608b133944f452c448f2bbb8ebc4286db50 Mon Sep 17 00:00:00 2001 From: deveco_xdevice Date: Thu, 10 Aug 2023 12:17:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=84=E9=81=BF=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E5=91=BD=E4=BB=A4=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?linux=E7=8E=AF=E5=A2=83=E4=B8=8Blast=E7=9B=AE=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: deveco_xdevice --- plugins/ohos/src/ohos/testkit/kit.py | 2 -- src/xdevice/variables.py | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/ohos/src/ohos/testkit/kit.py b/plugins/ohos/src/ohos/testkit/kit.py index c7a653c..9323d52 100644 --- a/plugins/ohos/src/ohos/testkit/kit.py +++ b/plugins/ohos/src/ohos/testkit/kit.py @@ -693,8 +693,6 @@ class AppInstallKit(ITestKit): if len(self.app_list) == 0: LOG.info("No app to install, skipping!") return - # to disable app install alert - device.execute_shell_command("setprop persist.sys.platformautotest 1") for app in self.app_list: if self.alt_dir: app_file = get_file_absolute_path(app, self.paths, diff --git a/src/xdevice/variables.py b/src/xdevice/variables.py index fb45a29..e0016ea 100644 --- a/src/xdevice/variables.py +++ b/src/xdevice/variables.py @@ -15,8 +15,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +import getpass import os +import platform import sys import tempfile from dataclasses import dataclass @@ -66,8 +67,7 @@ def _init_global_config(): MODULES_DIR, "_core", "resource")) # create xdevice temp folder - Variables.temp_dir = os.path.join(tempfile.gettempdir(), - "xdevice_data") + Variables.temp_dir = os.path.join(_get_temp_dir(), "xdevice_data") if not os.path.exists(Variables.temp_dir): os.makedirs(Variables.temp_dir) @@ -97,6 +97,14 @@ def _init_global_config(): _init_logger() +def _get_temp_dir(): + name = platform.system() + if name == "Linux": + return os.path.join(tempfile.gettempdir(), getpass.getuser()) + else: + return tempfile.gettempdir() + + def _init_logger(): import time from _core.constants import LogType