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.py — test_main_runs_trace_and_exports_json_and_csv as template
tests/test_html_reporter.py — HTML content assertions to reuse
Checklist
Summary
Add a CLI integration test that verifies
--htmlcorrectly 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_csvcovers JSON and CSV, but there is no equivalent for--html.Proposed Solution
Add
test_main_runs_trace_and_exports_htmltotests/test_cli.pyusing the existingFakeTracer+_run_clipattern:--htmlwith atmp_pathoutput file0<!DOCTYPE html>andOracleTrace ReportHTML 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.htmlAlternatives Considered
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 reuseChecklist