Skip to content

[Feature] Reusable Configuration Profiles #204

@reach2jeyan

Description

@reach2jeyan

Summary

Allow users to define reusable reporting configurations (profiles) in a TOML file and invoke them via:
pytest --plus-profile=<name>

Support profile definitions in:

  • pyproject.toml under [tool.pytest-html-plus.profiles]
  • Activate via:
  • --plus-profile=ci=
  • CLI flags must override profile values
  • Backward compatible (no behavior change if profile not used)

Problem It Solves

What's the current limitation or pain point?

  1. CLI Duplication in CI
# pr.yml
run: pytest --html=report.html --json=report.json --screenshots=on-failure

# nightly.yml
run: pytest --html=nightly.html --json=nightly.json --screenshots=always

# release.yml
run: pytest --html=release.html --json=release.json --self-contained-html

Drift Between Local and CI
Developer runs this locally

pytest --html=local.html --screenshots=always

and then in CI

pytest --html=report.html --screenshots=on-failure

Configuration duplication and inconsistency across environments and pipelines.

Proposed Solution

Describe how you'd like it to work. If you have ideas on the API or CLI flags, show them:

Given a pyproject.toml file exists in project root
And contains [tool.pytest-html-plus.profiles.<profile_name>]
When user runs:
pytest --plus-profile=<profile_name>

Then:
The tool loads that profile
Applies the configuration values defined in it

Each profile key must map directly to existing CLI flags.

[tool.pytest-html-plus.profiles.ci]
html = "report.html"
json = "report.json"
screenshots = "on-failure"

Must behave identically to:
pytest --html-output=report.html --json-output=report.json --screenshots=on-failure --self-contained-html

Additional Context

Display errors when .toml malformed or invalid keys or multiple same keys in single profile

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions