Skip to content

Conversation

@SmartDever02
Copy link

PR Title

Add plugin-based custom test report formats (JSON/XML) and report_format config

Summary

  • Address : Feature Request: Support for Custom Test Report Formats #3641
  • Adds a pluggable report formatting system for tox test results.
  • Introduces report_format option (core/env) to select output format.
  • Provides built-in json and xml (JUnit) formatters.
  • Exposes plugin hook tox_register_report_formatter for custom formats.
  • Keeps backward compatibility: defaults to JSON if unspecified.
  • Reuses --result-json path; extension is adjusted to selected format.

Key Changes

  • New hook: tox_register_report_formatter in tox.plugin.spec.
  • Formatter infra: tox.report.formatter with registry.
  • Built-ins: tox.report.formatters.json, tox.report.formatters.xml.
  • Config: report_format added via tox.report.config plugin.
  • Journal writing now uses selected formatter.
  • Updated help text for --result-json.

Usage

  • In tox.ini:
    [tox]
    report_format = xml  # or json
  • CLI:
    • tox --result-json report produces report.xml or report.json based on report_format.

Plugin Extension

  • Third-party plugins can register formatters via:
    • tox_register_report_formatter(register) and register.register(MyFormatter()).

Compatibility

  • Defaults to JSON when not configured.
  • No breaking changes to existing workflows.

@SmartDever02 SmartDever02 marked this pull request as draft November 3, 2025 16:49
@SmartDever02 SmartDever02 marked this pull request as ready for review November 3, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant