Merge branch 'master' of github.com:DarkLii/deepin-autotest-framework

This commit is contained in:
DarkLii 2024-05-16 19:37:00 +08:00
commit e0e16fac57
8 changed files with 58 additions and 33 deletions

View File

@ -19,13 +19,17 @@
---
<a href="https://github.com/linuxdeepin/youqu" target="_blank">GitHub</a> | <a href="https://gitee.com/deepin-community/youqu" target="_blank">Gitee</a>
**Deepin 社区:** <a href="https://github.com/linuxdeepin/youqu" target="_blank">GitHub</a> | <a href="https://gitee.com/deepin-community/youqu" target="_blank">Gitee</a>
<a href="https://linuxdeepin.github.io/youqu" target="_blank">在线文档</a>
**openEuler 社区:** <a href="https://gitee.com/src-openeuler/youqu" target="_blank">Gitee</a>
**官方文档:** <a href="https://youqu.uniontech.com" target="_blank">https://youqu.uniontech.com</a>
**欢迎加入 [YouQu官方兴趣小组](https://youqu.uniontech.com/SIG.html)**
---
YouQu(有趣)是统信公司(Deepin/UOS)开源的一个用于 Linux 操作系统的自动化测试框架,支持多元化元素定位和断言、用例标签化管理和执行、强大的日志和报告输出等特色功能,同时完美兼容 X11、Wayland 显示协议,环境部署简单,操作易上手。🔥
YouQu有趣是统信公司Deepin/UOS开源的一个 Linux 操作系统的自动化测试框架,支持多元化元素定位和断言、用例标签化管理和执行、强大的日志和报告输出等特色功能,同时完美兼容 X11、Wayland 显示协议,环境部署简单,操作易上手。🔥
## YouQu有趣能做什么

View File

@ -35,6 +35,7 @@ export default withMermaid(
text: `v${version}`, items: [
{text: "更新日志", link: '/RELEASE'},
{text: "参与贡献", link: '/CONTRIBUTING'},
{text: "兴趣小组", link: '/SIG'},
]
},
{

7
docs/SIG.md Normal file
View File

@ -0,0 +1,7 @@
# YouQu 官方兴趣小组SIG
------------
加入 YouQu 官方兴趣小组SIG与众多 Linux自动化测试专家交流共同探索 YouQu 框架的无限可能,助力您的技术成长和职业发展!
<img src="/wechat.jpg" width = "400" alt="YouQu官方兴趣小组" align=center />

BIN
docs/assets/wechat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -192,13 +192,13 @@ class _GlobalConfig:
# [git]
git_cfg = GetCfg(GLOBAL_CONFIG_FILE_PATH, "git")
GIT_URL = log_cli.get("GIT_URL", default="")
GTI_USER = log_cli.get("GTI_USER", default="")
GIT_PASSWORD = log_cli.get("GIT_PASSWORD", default="")
BRANCH = log_cli.get("BRANCH", default="")
DEPTH = log_cli.get("DEPTH", default="")
START_DATE = log_cli.get("STAR_TDATE", default="")
END_DATE = log_cli.get("END_DATE", default="")
GIT_URL = git_cfg.get("GIT_URL", default="")
GIT_USER = git_cfg.get("GTI_USER", default="")
GIT_PASSWORD = git_cfg.get("GIT_PASSWORD", default="")
BRANCH = git_cfg.get("BRANCH", default="")
DEPTH = git_cfg.get("DEPTH", default="")
START_DATE = git_cfg.get("START_DATE", default="")
END_DATE = git_cfg.get("END_DATE", default="")
# ====================== 动态获取变量 ======================
VERSION = ""

View File

@ -1,4 +1,4 @@
def git_control(self, parser=None, sub_parser_git=None):
def git_control(parser=None, sub_parser_git=None):
sub_parser_git.add_argument(
"-a",
"--app",
@ -14,16 +14,17 @@ def git_control(self, parser=None, sub_parser_git=None):
sub_parser_git.add_argument("-e", "--enddate", default="", help="统计结束时间")
args = parser.parse_args()
from src.rtk._base import Args
from setting import conf
git_kwargs = {
Args.app_name.value: args.app or self.default_app,
Args.url.value: args.url or self.default_url,
Args.user.value: args.user or self.default_git_user,
Args.password.value: args.password or self.default_git_password,
Args.branch.value: args.branch or self.default_branch,
Args.depth.value: args.depth or self.default_depth,
Args.startdate.value: args.startdate or self.default_startdate,
Args.enddate.value: args.enddate or self.default_enddate,
Args.app_name.value: args.app or conf.APP_NAME,
Args.url.value: args.url or conf.GIT_URL,
Args.user.value: args.user or conf.GIT_USER,
Args.password.value: args.password or conf.GIT_PASSWORD,
Args.branch.value: args.branch_or_tag or conf.BRANCH,
Args.depth.value: args.depth or conf.DEPTH,
Args.startdate.value: args.startdate or conf.START_DATE,
Args.enddate.value: args.enddate or conf.END_DATE,
}
from src.git.check import check_git_installed
@ -39,7 +40,7 @@ def git_control(self, parser=None, sub_parser_git=None):
from src.git.clone import clone as git_clone
check_git_installed()
git_clone(**git_kwargs)
if all(
elif all(
[
git_kwargs.get(Args.app_name.value),
git_kwargs.get(Args.startdate.value),
@ -49,3 +50,6 @@ def git_control(self, parser=None, sub_parser_git=None):
check_git_installed()
CodeStatistics(**git_kwargs).codex()
else:
print("参数异常")

View File

@ -2,27 +2,27 @@
# _*_ coding:utf-8 _*_
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
# SPDX-License-Identifier: GPL-2.0-only
import os
import json
import os
from copy import deepcopy
from datetime import datetime
from setting import conf
from src.rtk._base import transform_app_name
from src.git.commit import Commit
from src.depends.colorama import Fore
from src.git.commit import Commit
from src.rtk._base import transform_app_name
class CodeStatistics(Commit):
__author__ = "mikigo<huangmingqiang@uniontech.com>"
def __init__(
self,
app_name: str,
branch: str,
startdate: str = None,
enddate: str = None,
**kwargs,
self,
app_name: str,
branch: str,
startdate: str = None,
enddate: str = None,
**kwargs,
):
self.app_name = transform_app_name(app_name or conf.APP_NAME)
self.repo_path = f"{conf.APPS_PATH}/{self.app_name}"
@ -31,7 +31,7 @@ class CodeStatistics(Commit):
if startdate:
super().__init__(app_name, branch=branch, startdate=startdate, enddate=enddate)
self.ignore_txt = ["from", "import"]
self.ignore_txt = ["from", "import", '"""', ' """', "class", "#", "@"]
for i in range(100):
self.ignore_txt.append(" " * i + "#")
@ -60,7 +60,7 @@ class CodeStatistics(Commit):
git_files = self.get_git_files(commit_id=commit_id)
for filepath in git_files:
filename = filepath.split("/")[-1]
dif_texts = os.popen(f"cd {self.repo_path}/;git show {commit_id} {filepath}").read()
dif_texts = os.popen(f"cd {self.repo_path}/;git show {commit_id} -- {filepath}").read()
print(Fore.GREEN, "=" * 100, Fore.RESET)
print(filepath, "\n", dif_texts)
dif_lines = dif_texts.splitlines()
@ -101,7 +101,11 @@ class CodeStatistics(Commit):
if method_content:
for content in method_content:
if content.startswith(("-", "+")):
if content[1:].startswith(tuple(self.ignore_txt)):
if any([
content[1:].startswith(tuple(self.ignore_txt)),
content[1:] == "",
content[1:].endswith(('"""', "@staticmethod", "@classmethod"))
]):
continue
_fix_debug.append(method)
fix_method_num += 1
@ -119,6 +123,11 @@ class CodeStatistics(Commit):
if method_content:
for content in method_content:
if content.startswith(("-", "+")):
if any([
content[1:] == "",
content[1:].endswith(('"""', "@staticmethod", "@classmethod"))
]):
continue
_fix_debug.append(method)
fix_method_num += 1
break

View File

@ -192,7 +192,7 @@ echo "pipenv shell" | sudo tee /usr/bin/youqu-shell > /dev/null 2>&1
echo "pipenv --rm" | sudo tee /usr/bin/youqu-rm > /dev/null 2>&1
sudo chmod +x /usr/bin/youqu
sudo chmod +x /usr/bin/youqu-shell
sudo chmod +x /usr/bin/youqu-shell-rm
sudo chmod +x /usr/bin/youqu-rm
#cp --force ${ROOT_DIR}/src/utils/command_complete.sh ${HOME}/.config/
#echo "source ${HOME}/.config/command_complete.sh" >> $HOME/.bashrc