diff --git a/README.md b/README.md index 0bed8bb..e54048c 100644 --- a/README.md +++ b/README.md @@ -59,26 +59,26 @@ pip install youqu3[http] ## [YouQu3插件生态]() -| 序号 | 插件名称 | 说明 | 可用 | -| :----------------------------------------------------------: | ------------------------------------ | ------------------------------------ | :----------------------------------: | -| 1 | [youqu-dogtail](https://github.com/funny-dream/youqu-dogtail) | 属性定位插件 | ✔️ | -| 2 | [youqu-imagecenter-rpc](https://github.com/funny-dream/youqu-imagecenter-rpc) | 基于 RPC 服务的图像识别插件 | ✔️ | -| 3 | [youqu-mousekey](https://github.com/funny-dream/youqu-mousekey) | 键鼠操作插件 | ✔️ | -| 4 | [youqu-dbus](https://github.com/funny-dream/youqu-dbus) | D-Bus 操控插件 | ✔️ | -| 5 | youqu-pms-driver | PMS 测试单驱动插件 | - | -| 6 | [youqu-button-center](https://github.com/funny-dream/youqu-button-center) | 相对位移定位插件 | ✔️ | -| 7 | [pytest-mark-manage](https://github.com/funny-dream/pytest-mark-manage) | 用例标签化管理插件 | ✔️ | -| 8 | [pytest-youqu-playwright](https://github.com/funny-dream/pytest-youqu-playwright) | 基于 Playwright 的 Web UI 自动化插件 | ✔️ | -| 9 | [youqu-html](https://github.com/funny-dream/youqu-html) | YouQu Html Report | ✔️ | -| 10 | pytest-record-video | 用例失败录屏插件 | - | -| 11 | [funnylog](https://linuxdeepin.github.io/funnylog/) | 全自动日志插件 | ✔️ | -| 12 | [pdocr-rpc](https://linuxdeepin.github.io/pdocr-rpc/) | 基于 RPC 服务的 OCR 识别插件 | ✔️ | -| 13 | [wdotool](https://github.com/funny-dream/wdotool) | Wayland 下完美的键鼠工具 | - | +| 序号 | 插件名称 | 说明 | +| :----------------------------------------------------------: | ------------------------------------ | ------------------------------------ | +| 1 | [youqu-dogtail](https://github.com/funny-dream/youqu-dogtail) | 属性定位插件 | +| 2 | [youqu-imagecenter-rpc](https://github.com/funny-dream/youqu-imagecenter-rpc) | 基于 RPC 服务的图像识别插件 | +| 3 | [youqu-mousekey](https://github.com/funny-dream/youqu-mousekey) | 键鼠操作插件 | +| 4 | [youqu-dbus](https://github.com/funny-dream/youqu-dbus) | D-Bus 操控插件 | +| 5 | youqu-pms-driver | PMS 测试单驱动插件 | +| 6 | [youqu-button-center](https://github.com/funny-dream/youqu-button-center) | 相对位移定位插件 | +| 7 | [pytest-mark-manage](https://github.com/funny-dream/pytest-mark-manage) | 用例标签化管理插件 | +| 8 | [pytest-youqu-playwright](https://github.com/funny-dream/pytest-youqu-playwright) | 基于 Playwright 的 Web UI 自动化插件 | +| 9 | [youqu-html](https://github.com/funny-dream/youqu-html) | YouQu Html Report | +| 10 | [pytest-record-video](https://github.com/funny-dream/pytest-record-video) | 用例失败录屏插件 | +| 11 | [funnylog](https://linuxdeepin.github.io/funnylog/) | 全自动日志插件 | +| 12 | [pdocr-rpc](https://linuxdeepin.github.io/pdocr-rpc/) | 基于 RPC 服务的 OCR 识别插件 | +| 13 | [wdotool](https://github.com/funny-dream/wdotool) | Wayland 下完美的键鼠工具 | ## [UOS测试套件]() -| 序号 | 套件名称 | 说明 | 状态 | -| :--: | ------------------------------------------------------------ | -------------------------- | :--: | -| 1 | [uos-method-toolkit](https://github.com/funny-dream/uos-method-toolkit)(UMTK ) | UOS 自动化测试操作方法套件 | 🔥 | -| 2 | [uos-case-toolkit](https://github.com/funny-dream/uos-case-toolkit)(UCTK ) | UOS 自动化测试操作用例套件 | 🔥 | +| 序号 | 套件名称 | 说明 | +| :--: | ------------------------------------------------------------ | -------------------------- | +| 1 | [uos-method-toolkit](https://github.com/funny-dream/uos-method-toolkit)(UMTK ) | UOS 自动化测试操作方法套件 | +| 2 | [uos-case-v20](https://github.com/funny-dream/uos-case-v20) | UOS 自动化测试操作用例 | diff --git "a/docs/\350\256\276\350\256\241/UOS\350\207\252\345\212\250\345\214\226\346\265\213\350\257\225\347\224\250\344\276\213.md" "b/docs/\350\256\276\350\256\241/UOS\350\207\252\345\212\250\345\214\226\346\265\213\350\257\225\347\224\250\344\276\213.md" index a6bc699..f0614e0 100644 --- "a/docs/\350\256\276\350\256\241/UOS\350\207\252\345\212\250\345\214\226\346\265\213\350\257\225\347\224\250\344\276\213.md" +++ "b/docs/\350\256\276\350\256\241/UOS\350\207\252\345\212\250\345\214\226\346\265\213\350\257\225\347\224\250\344\276\213.md" @@ -6,7 +6,7 @@ Author : mikigo ## 1. 简介 -UOS 自动化测试用例,以下简称测试用例套件,是基于 YouQu3 和 UMTK 编写的 UOS 系统级测试用例,旨在提供 UOS 系统所有预装应用的测试用例。 +UOS 自动化测试用例,以下简称测试用例,是基于 YouQu3 和 UMTK 编写的 UOS 系统级测试用例,旨在提供 UOS 系统所有预装应用的测试用例。 ## 2. 工程设计 diff --git a/pyproject.toml b/pyproject.toml index 121de40..ed5313f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ "pytest-json-report", "funnylog", "click", - "pexpect" + "pexpect", "youqu-html", ] dynamic = [ diff --git a/youqu3/cmd.py b/youqu3/cmd.py index 4bfd6cb..1552434 100644 --- a/youqu3/cmd.py +++ b/youqu3/cmd.py @@ -13,7 +13,7 @@ def _run(command, _input=None, timeout=None, check=False, **kwargs): with subprocess.Popen(command, **kwargs) as process: try: stdout, stderr = process.communicate(_input, timeout=timeout) - except: # Including KeyboardInterrupt, communicate handled that. + except: process.kill() raise retcode = process.poll() @@ -43,7 +43,6 @@ def _getstatusoutput(cls, command, timeout): data = ex.output exitcode = ex.returncode except subprocess.TimeoutExpired as ex: - # pylint: disable=unnecessary-dunder-call data = ex.__str__() exitcode = -1 if data[-1:] == "\n": @@ -81,7 +80,12 @@ def run( return stdout @staticmethod - def expect_run(cmd: str, events: dict, return_code=False, timeout: int = 30): + def expect_run( + cmd: str, + events: dict, + return_code=False, + timeout: int = 30 + ): """ expect_run( "ssh username@machine.example.com 'ls -l'", @@ -90,7 +94,12 @@ def expect_run(cmd: str, events: dict, return_code=False, timeout: int = 30): 如果 return_code=True,返回 (stdout, return_code) """ import pexpect - return pexpect.run(cmd, events=events, withexitstatus=return_code, timeout=timeout) + return pexpect.run( + cmd, + events=events, + withexitstatus=return_code, + timeout=timeout + ) @classmethod def sudo_run( @@ -147,10 +156,14 @@ def remote_sudo_run(self, cmd: str, return_code: bool = False): return res.stdout, res.return_code return res.stdout + def remote_expect_run(self): + # TODO + ... + if __name__ == '__main__': stdout = Cmd.run( - "sshpass -p '1' rsync -av -e ssh --exclude='__pycache__' --exclude='.pytest_cache' --exclude='.vscode' --exclude='.idea' --exclude='.git' --exclude='.github' --exclude='.venv' --exclude='report' --exclude='.gitignore' /home/mikigo/github/youqu3-testcase/* uos@10.8.7.55:/home/uos/youqu3-testcase/", + "ls", interrupt=True, print_log=False, )