[Feature]: Add CLI integration test for --html export
#66 opened on Jun 16, 2026
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
--htmlwith atmp_pathoutput file - Assert exit code
0 - Assert the HTML file exists and contains
<!DOCTYPE html>andOracleTrace 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_csvto 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.py—test_main_runs_trace_and_exports_json_and_csvas templatetests/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