From 19c027442a09403c8e3e447b409cb22a3df74ef3 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Sun, 6 Aug 2023 12:07:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0python=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=B8=BA3.10=20(#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 更新python环境版本为3.10 * 修复ci意外类型诊断 --- .github/workflows/ci.yml | 2 +- .pre-commit-config.yaml | 2 +- .ruff.toml | 2 +- README.md | 34 ++++++--------------------------- httpfpt/utils/allure_control.py | 2 +- pyrightconfig.json | 3 ++- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 787fe04..67cf47b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: name: lint ${{ matrix.python-version }} strategy: matrix: - python-version: ['3.8'] + python-version: ['3.10'] fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70180a5..f2e4b2f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: rev: 23.3.0 hooks: - id: black - language_version: python3.8 + language_version: python3.10 args: - '--skip-string-normalization' - '--line-length' diff --git a/.ruff.toml b/.ruff.toml index e537101..57e05fb 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -19,7 +19,7 @@ select = [ ] line-length = 120 format = "grouped" -target-version = "py38" +target-version = "py310" cache-dir = "./httpfpt/.ruff_cache" extend-exclude = ["httpfpt/conftest.py"] diff --git a/README.md b/README.md index a5b3863..4977a35 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,20 @@ # HttpFpt -基于数据驱动的接口自动化测试框架 - -Http: http 请求, - -F:fast, - -pt:pytest +基于 HTTP 请求的快速数据驱动 pytest 接口自动化测试框架 ## 功能点 - 多项目分级,自由切换,互不干扰 - 测试数据隔离,自动解析与验证 -- 多环境自定义配置,不同数据文件可以选择不同的运行环境 -- 动态环境配置,自动识别和应用当前请求所需的基础环境数据 +- 测试数据错误定位(参数错误,重复测试用例ID...) +- 多环境自定义配置,不同用例可以选择不同的运行环境 +- 动态环境配置,自动识别和应用当前请求所需的基础环境配置 - 动态参数化,可以通过全局变量,局部变量,缓存变量,关联变量等方式进行参数化 - 数据依赖,支持接口返回数据共享,轻松实现接口依赖 -- 钩子函数,动态数据,自定义扩展等等由你自由发挥 +- 钩子函数,支持调用自定义钩子函数,实现更多的自定义功能 - 日志记录,自动记录测试过程中的请求数据日志 - 多元化断言,json断言,sql断言,原生 python assert 断言 -- 测试用例自动生成,可以根据接口测试数据自动生成测试用例 +- 测试用例自动生成,可以根据测试数据文件自动生成测试用例 - 自动测试报告,html, allure - 自动测试结果通知,飞书,钉钉,~~企业微信~~,邮箱 - ...... @@ -27,20 +22,3 @@ pt:pytest ## 帮助 有关更多详细信息,请参阅 [文档](https://wu-clan.github.io/httpfpt_docs) - -## 贡献 - -欢迎加入,如果你有好的想法,可以提交 issues 或 pr - -对于 PR: - -1. Fork 仓库 -2. git clone 你的仓库 -3. 创建虚拟环境 `python3 -m venv venv` -4. 激活虚拟环境 `source venv/bin/activate` -5. 创建分支 `git checkout -b my-new-feature` -6. 提交修改到分支 `git commit -am 'Add some feature'` -7. 执行 ruff 检查并修复 `ruff check . --fix` -8. 执行 pre-commit 检查并修复 `pre-commit run --all-files --verbose` -9. 提交分支 `git push origin my-new-feature` -10. 创建 PR diff --git a/httpfpt/utils/allure_control.py b/httpfpt/utils/allure_control.py index baeb217..359142e 100644 --- a/httpfpt/utils/allure_control.py +++ b/httpfpt/utils/allure_control.py @@ -17,7 +17,7 @@ def allure_step(step: str, var: Union[str, dict]) -> None: :param var: 操作步骤中的变量 :return: """ - with allure.step(step): + with allure.step(step): # type: ignore allure.attach( body=json.dumps(var, ensure_ascii=False, indent=2) if isinstance(var, dict) else var, name='JSON Serialize', diff --git a/pyrightconfig.json b/pyrightconfig.json index 402e2b8..a75f39f 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -13,5 +13,6 @@ "reportUnusedImport": "error", "reportOptionalMemberAccess": false, "reportOptionalSubscript": false, - "pythonVersion": "3.8" + "pythonVersion": "3.10", + "pythonPlatform": "All" }