KaykCaputo/oracletrace

[Feature]: Add CLI integration test for --html export

Open

#66 opened on Jun 16, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (16 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (21 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

Add a CLI integration test that verifies --html correctly exports an HTML report through the main command path.

Problem

The HTML reporter has 7 unit tests in tests/test_html_reporter.py, but the CLI wiring in _export_results() is untested. test_main_runs_trace_and_exports_json_and_csv covers JSON and CSV, but there is no equivalent for --html.

Proposed Solution

Add test_main_runs_trace_and_exports_html to tests/test_cli.py using the existing FakeTracer + _run_cli pattern:

  • Pass --html with a tmp_path output file
  • Assert exit code 0
  • Assert the HTML file exists and contains <!DOCTYPE html> and OracleTrace Report
  • Optionally assert stdout contains HTML report generated:

Use Case

Prevents regressions in CLI argument parsing, export ordering, or the success message for HTML output — a path users rely on for interactive trace inspection.

Example (optional)

# Covered by the new test (mocked CLI invocation)
oracletrace app.py --html report.html
HTML report generated: /path/to/report.html

Alternatives Considered

  • End-to-end test running a real script without mocks — heavier and slower; mocked CLI tests match existing conventions.
  • Extending test_main_runs_trace_and_exports_json_and_csv to also cover HTML — possible, but a dedicated test keeps failures easier to diagnose.

Additional Context

Relevant files:

  • oracletrace/cli.py_export_results() (lines 122–124)
  • tests/test_cli.pytest_main_runs_trace_and_exports_json_and_csv as template
  • tests/test_html_reporter.py — HTML content assertions to reuse

Checklist

  • I searched existing issues before opening this request
  • I described the problem and why this feature is useful
  • I provided enough detail for implementation discussion

Contributor guide