Skip to main content

pytest-relative-path

Languate - Python PyPI - License PyPI PyPI - Downloads

处理Pytest参数及配置中的相对路径,将相对于执行目录改为项目项目根目录,支持时间戳。


如何使用

  1. 安装 pytest-relative-path

使用pip安装

pip install pytest-relative-path
  1. 在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

  1. 支持插件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-relative-path 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-relative-path 0.1.3
File Size Uploaded
pytest_relative_path-0.1.3.tar.gz 5.0 kB Details

Release files / pytest_relative_path-0.1.3.tar.gz

Download URL pytest_relative_path-0.1.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e242c9bd15ef36791760c67dbf8693ee1842451727ea940f984fe9be22c330e
BLAKE2b-256 checksum
How to use checksums
4c3ce6e085b49022957bdb94b6846c82bdac43e74a627638bcf95607252913f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page