Skip to content

Commit

Permalink
fix: 修复一些已知问题;
Browse files Browse the repository at this point in the history
Description:

Log:
  • Loading branch information
mikigo committed Dec 4, 2023
1 parent eeb3447 commit 1840c82
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CURRENT
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[current]
tag = 2.3.4-dev
tag = 2.3.4
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
<p align="center">
<em>有趣,一个使用简单且功能强大的自动化测试基础框架。</em>
</p>

![PyPI](https://img.shields.io/pypi/v/youqu?style=flat&logo=github&link=https%3A%2F%2Fpypi.org%2Fproject%2Fyouqu%2F&color=%2344CC11)
![PyPI - License](https://img.shields.io/pypi/l/youqu?color=blue&color=%2344CC11)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/youqu?color=%2344CC11)
![Static Badge](https://img.shields.io/badge/UOS%2FDeepin/Ubuntu/Debian-Platform?style=flat&label=OS)
![Static Badge](https://img.shields.io/badge/Linux-Platform?style=flat&label=Platform)
![PyPI](https://img.shields.io/pypi/v/youqu?style=flat&logo=github&link=https%3A%2F%2Fpypi.org%2Fproject%2Fyouqu%2F&color=%23F79431)
![PyPI - License](https://img.shields.io/pypi/l/youqu?color=%23F79431)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/youqu?color=%23F79431)
![Static Badge](https://img.shields.io/badge/UOS%2FDeepin/Ubuntu/Debian-Platform?style=flat&label=OS&color=%23F79431)
![Static Badge](https://img.shields.io/badge/Linux-Platform?style=flat&label=Platform&color=%23F79431)

[![Downloads](https://static.pepy.tech/badge/youqu/week)](https://pepy.tech/project/youqu)
[![Downloads](https://static.pepy.tech/badge/youqu/month)](https://pepy.tech/project/youqu)
Expand Down
10 changes: 10 additions & 0 deletions setting/globalconfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,19 @@ SYS_THEME = deepin

;OCR服务端地址(不可随意修改)
OCR_SERVER_HOST = youqu-dev.uniontech.com
OCR_PORT = 8890
OCR_NETWORK_RETRY = 1
OCR_PAUSE = 1
OCR_TIMEOUT = 5
OCR_MAX_MATCH_NUMBER = 100

;OpenCV服务端地址
OPENCV_SERVER_HOST = youqu-dev.uniontech.com
OPENCV_PORT = 8889
OPENCV_NETWORK_RETRY = 1
OPENCV_PAUSE = 1
OPENCV_TIMEOUT = 5
OPENCV_MAX_MATCH_NUMBER = 100

;=============================== REPORT CONFIG ===================================
[report]
Expand Down
13 changes: 13 additions & 0 deletions setting/globalconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,21 @@ class DirName:
SCREEN_CACHE = run_cfg.get("SCREEN_CACHE", default="/tmp/screen.png")
TMPDIR = run_cfg.get("TMPDIR", default="/tmp/tmpdir")
SYS_THEME = run_cfg.get("SYS_THEME", default="deepin")


OCR_SERVER_HOST = run_cfg.get("OCR_SERVER_HOST", default="localhost")
OCR_PORT = run_cfg.get("OCR_PORT", default="8890")
OCR_NETWORK_RETRY = run_cfg.get("OCR_NETWORK_RETRY", default=1)
OCR_PAUSE = run_cfg.get("OCR_PAUSE", default=1)
OCR_TIMEOUT = run_cfg.get("OCR_TIMEOUT", default=5)
OCR_MAX_MATCH_NUMBER = run_cfg.get("OCR_MAX_MATCH_NUMBER", default=100)

OPENCV_SERVER_HOST = run_cfg.get("OPENCV_SERVER_HOST", default="localhost")
OPENCV_PORT = run_cfg.get("OPENCV_PORT", default="8889")
OPENCV_NETWORK_RETRY = run_cfg.get("OPENCV_NETWORK_RETRY", default=1)
OPENCV_PAUSE = run_cfg.get("OPENCV_PAUSE", default=1)
OPENCV_TIMEOUT = run_cfg.get("OPENCV_TIMEOUT", default=5)
OPENCV_MAX_MATCH_NUMBER = run_cfg.get("OPENCV_MAX_MATCH_NUMBER", default=100)

# [report]
report_cfg = GetCfg(GLOBAL_CONFIG_FILE_PATH, "report")
Expand Down
7 changes: 1 addition & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

from funnylog import log
from funnylog import logger
from pdocr_rpc import OCR
from pdocr_rpc.conf import setting as ocr_setting

from setting.globalconfig import GlobalConfig

ocr_setting.SERVER_IP = GlobalConfig.OCR_SERVER_HOST

from setting.globalconfig import SystemPath

Expand All @@ -29,6 +23,7 @@
from src.cmdctl import CmdCtl
from src.dogtail_utils import DogtailUtils
from src.image_utils import ImageUtils
from src.ocr_utils import OCRUtils as OCR
from src.button_center import ButtonCenter
from src.filectl import FileCtl
from src.shortcut import ShortCut
Expand Down
3 changes: 1 addition & 2 deletions src/assert_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
except ModuleNotFoundError:
pass

from src.ocr_utils import OCRUtils as OCR
from src.image_utils import ImageUtils
from src.filectl import FileCtl
from src.dogtail_utils import DogtailUtils
Expand All @@ -25,10 +26,8 @@
from src.cmdctl import CmdCtl
from src.button_center import ButtonCenter
from src import logger, log
from src import OCR
from setting.globalconfig import GlobalConfig


# pylint: disable=too-many-public-methods
@log
class AssertCommon:
Expand Down
12 changes: 8 additions & 4 deletions src/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
from image_center import ImageCenter
from image_center.conf import setting as image_setting

from setting.globalconfig import GlobalConfig

image_setting.PORT = 8889
image_setting.SERVER_IP = GlobalConfig.OPENCV_SERVER_HOST
from setting import conf

image_setting.PORT = conf.OPENCV_PORT
image_setting.SERVER_IP = conf.OPENCV_SERVER_HOST
image_setting.NETWORK_RETRY = int(conf.OPENCV_NETWORK_RETRY)
image_setting.PAUSE = float(conf.OPENCV_PAUSE)
image_setting.TIMEOUT = float(conf.OPENCV_TIMEOUT)
image_setting.MAX_MATCH_NUMBER = int(conf.OPENCV_MAX_MATCH_NUMBER)


class ImageUtils(ImageCenter):
Expand Down
30 changes: 30 additions & 0 deletions src/ocr_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_

# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.

# SPDX-License-Identifier: GPL-2.0-only
# pylint: disable=C0114
# pylint: disable=E0401,C0413,R0903,W0707,W0611
try:
import cv2 as cv

GET_OPENCV_FORM_RPC = False
except ModuleNotFoundError:
GET_OPENCV_FORM_RPC = True

from pdocr_rpc import OCR as _OCR
from pdocr_rpc.conf import setting as ocr_setting

from setting import conf

ocr_setting.PORT = conf.OCR_PORT
ocr_setting.SERVER_IP = conf.OCR_SERVER_HOST
ocr_setting.NETWORK_RETRY = int(conf.OCR_NETWORK_RETRY)
ocr_setting.PAUSE = float(conf.OCR_PAUSE)
ocr_setting.TIMEOUT = float(conf.OCR_TIMEOUT)
ocr_setting.MAX_MATCH_NUMBER = int(conf.OCR_MAX_MATCH_NUMBER)


class OCRUtils(_OCR):
"""OCR识别的工具类"""
4 changes: 2 additions & 2 deletions src/rtk/local_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ def local_run(self):

app_dir = self.change_working_dir()
run_test_cmd_list = self.create_pytest_cmd(app_dir)
run_test_cmd = " ".join(run_test_cmd_list)

if not self.default.get(Args.pms_info_file.value):
print(f"Running: \n{run_test_cmd}")
...
# print(f'Running: \n{" ".join(run_test_cmd_list)}')
if self.default.get(Args.debug.value):
logger.info("Debug 模式不执行用例!")
return
Expand Down

0 comments on commit 1840c82

Please sign in to comment.