项目描述
通过解析IDL自动生成PyTest单测框架, 通过Faker库辅助生成部分参数, 并且支持单测参数和单测逻辑的向后兼容
安装
pip install pytest
pip install pyaml
pip install Faker==1.0.4
pip install bson
pip install dictdiffer
示例代码
from auto_red_test import generate_red_test
from frame import ENV
from handler.stockage_handler import StockageHandler # 需要单测的handler
import stockage_service.request.ttypes as test_request # idl的request文件
import stockage_service.StockageService as test_service # idl的service文件
root_path = ENV['root'] # 项目的根目录
# 第二个参数可以是handler列表,但必须属于同一个service
generate_red_test(root_path, StockageHandler, test_service, test_request)
- 自动生成的单测框架如下:
补充内容
- 第一次运行会生成request_config.yaml,可以自定义单测方法的参数,用于解决一个单测方法用到多个request的特殊情况, 格式如下:
# 配置单测参数
methodA:
request_A_name: request_A_obj_name
request_B_name: request_A_obj_name
methodB:
request_B_name: request_B_obj_name
request_C_name: request_C_obj_name
methodA为单测方法名, request_A_name为请求参数名,request_A_obj_name为请求参数对应的IDL Request名
Metadata
Release files for auto-red-test 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| auto-red-test-0.2.1.tar.gz | 9.1 kB | Without provenance | Details for auto-red-test-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| auto_red_test-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for auto_red_test-0.2.1-py2.py3-none-any.whl |
Total release size: 19.2 kB
Release files / auto-red-test-0.2.1.tar.gz
| Download URL | auto-red-test-0.2.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cacb926a707909db280f57b0ac3429811a596b1a3aae3ca56584eef52dbaa3a
|
|
BLAKE2b-256 checksum How to use checksums |
05464c05c49ac116441d640ab99d6246091bbb5597ae58c7f12fc881efb14a8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.13
|
Release files / auto_red_test-0.2.1-py2.py3-none-any.whl
| Download URL | auto_red_test-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2271e1a1aabb732d6a0c1fe2a1ca9d409b723643f1ebb3bc51b0206c0e6dc805
|
|
BLAKE2b-256 checksum How to use checksums |
94d397f9005eda6e904a56e1eddc29f1ad4781a8ee0c5c866a2c745b5bb75855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.13
|
Security for auto-red-test 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.