pytest-testdata
处理Pytest参数及配置中的相对路径,将相对于执行目录改为项目项目根目录,支持时间戳。
如何使用
- 安装
pytest-testdata
使用pip安装
pip install pytest-testdata
- 在pytest命令行参数或pytest.ini配置中,路径以'.'开头,支持时间戳
pytest . --log-file=./logs/%Y%m%d%H%M%S.log
或在pytest.ini中配置
[pytest]
log_file=./logs/%Y%m%d%H%M%S.log
并执行
pytest .
无论执行路径,将固定在项目根目录按时间戳生成日志,例如 (rootdir)/logs/20240830122250.log
- 支持插件pytest-html、allure-pytest、pytest-data-file、pytest-variables等,例如
pytest . --html=./reports/TestReport-%Y%m%d%H%M%S.html --alluredir=./reports/allure_data --data-file=./data/a.json --variables=./data/b.json
无论执行路径如何,报告会固定生成在项目/reports目录下,数据会固定从项目/data目录下寻找
Release files for pytest-testdata 0.1.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 | |
|---|---|---|---|
| pytest_testdata-0.1.1.tar.gz | 3.8 kB | Details |
Release files / pytest_testdata-0.1.1.tar.gz
| Download URL | pytest_testdata-0.1.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcef08c9f63d7d169cf29bea960fde52a5a0f5b2f36e26db964d72fc9bf0b6e8
|
|
BLAKE2b-256 checksum How to use checksums |
8240cb7b3c3d30d02a341d1023a603007e2041e846f18590f58da560e65bc7a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.6
|