numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
146 stars 39 forks source link

Expand user and env vars on configured report path #91

Open amartani opened 1 year ago

amartani commented 1 year ago

Expand environment variables ($FOO) and user dirs (~/) passed in --json-report-file.

In particular, this is useful in cases where these are configured via config files (eg. pytest.ini) rather than being passed in directly in the command line. It also matches the behavior of --junitxml on pytest itself:

https://github.com/pytest-dev/pytest/blob/485c555812286003d9234b5818c9852c3256bccb/src/_pytest/junitxml.py#L475

And other similar plugins such as pytest-html:

https://github.com/pytest-dev/pytest-html/blob/8bc9a5d89b53a417c90645233597d0b506793d13/src/pytest_html/basereport.py#L22