TST: cover the rocket and Monte Carlo plot branches - #1178
Draft
ting-hong-shieh wants to merge 1 commit into
Draft
TST: cover the rocket and Monte Carlo plot branches#1178ting-hong-shieh wants to merge 1 commit into
ting-hong-shieh wants to merge 1 commit into
Conversation
rocket_plots.py sat at 73.9% and monte_carlo_plots.py at 63.1% because the fixtures never reached several drawing branches. For rocket_plots, add drawings for a rocket carrying one individual Fin rather than a fin set, one carrying a GenericSurface, one on a hybrid motor, one on a liquid motor, one on a ring cluster, and one whose nozzle sits behind its last aerodynamic surface in each coordinate system. Add the two validation refusals. For monte_carlo_plots, cover the ellipse branches that run when a results file is missing its apogee or its impact series, when it has neither, when the image path does not exist, and when a landing point and an image are drawn. Background-map fetching stays in test_monte_carlo_plots_background.py; everything added here runs with background=None and contacts no provider. No production code changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1178 +/- ##
===========================================
+ Coverage 84.57% 85.16% +0.58%
===========================================
Files 131 131
Lines 17527 17527
===========================================
+ Hits 14824 14926 +102
+ Misses 2703 2601 -102 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ting-hong-shieh
marked this pull request as draft
August 16, 2026 19:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TST: cover the rocket and Monte Carlo plot branches
Works toward #709.
Why these two modules
At
4263fa95d7fe6f63d9593f01e4ff7a088369e195,plots/rocket_plots.pymeasures 73.9% andplots/monte_carlo_plots.py85.1% in the run that gates every pull request. Neither is untested; the fixtures simply never reach several branches.Rocket.drawdispatches per component type, and the test rockets only ever carry a nose cone, a tail and a fin set on a solid motor. So the branches for an individualFin, for aGenericSurface, for hybrid and liquid motors, for a ring cluster, and for a nozzle that sits behind the last aerodynamic surface were never entered.The ellipse plots read their series out of
resultswithtry/except KeyError, so the warning paths only run when a results file is missing a series — which no fixture produces.What this adds
Two test-only files. No production code changes.
tests/unit/rocket/test_rocket_plots.py, 15 cases:Fin, three fin classes × two planes_draw_fin, which rotates a single fin out of its own frame rather than a setGenericSurface, two planes_draw_generic_surface, the only branch that reads position by indexHybridMotorarm of_generate_motor_patchesLiquidMotorarm_draw_nozzle_tube__validate_aerodynamic_surfacestests/unit/simulation/test_monte_carlo_plots.py, 8 cases: results missing their apogee series, missing their impact series, missing both, animagepath that does not exist, and animagedrawn together withactual_landing_point— for bothellipsesandellipses_comparison.Background-map fetching stays where it already lives, in
test_monte_carlo_plots_background.py. Everything added here passesbackground=Noneand contacts no tile provider.Effect
plots/rocket_plots.pyplots/monte_carlo_plots.pyThat is +102 statements. The unit step goes from 2,185 to 2,208 passing, and no step slows measurably: 133.83s to 134.14s for unit, 89.90s to 89.40s for integration.
Measured by running the five steps of
test_pytest.yamlin order — unit, doctests, integration with the three animation deselects, the VTK animation tests, acceptance — each--cov-append, before and after this branch on the same machine with the same script. The baseline agrees with Codecov's figure for the same commit to the statement: 14,824 covered, 2,703 missed, against Codecov's 84.57%.This branch sits on
develop, not on #1176. The two touch disjoint modules — that one moves theEnvironmentAnalysisfiles, this one moves the two plot files — so the +945 and the +102 add rather than overlap, which would put the pair above the 90% this issue asks for. That is arithmetic on disjoint sets rather than a measured combined run; Codecov will report each againstdevelopon its own.One thing worth fixing separately
That baseline only agrees once
contextilyis installed, andmake installdoes not install it. It is declared in themonte-carloextra inpyproject.tomlbut not inrequirements-optional.txt, which is what the Makefile reads.test_monte_carlo_plots_background.pyopens withpytest.importorskip("contextily"), so a contributor following the documented setup silently skips 18 tests and measures 53 statements less than CI reports, with nothing pointing at why. The workflow installs.[all], so CI is unaffected. Raised separately rather than folded in here.No CHANGELOG entry: the file asks for tests to be left out.
Measured on Python 3.12.3, Linux.