KaykCaputo/oracletrace

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

オープン

#66 opened on 2026/06/16

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Python (16 件のフォーク)auto 404
enhancementgood first issue

Repository metrics

Stars
 (21 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド