Skip to content

TST: cover controller behavior and reporting - #1152

Merged
Gui-FernandesBR merged 1 commit into
RocketPy-Team:developfrom
ting-hong-shieh:codex/test-controller-coverage
Aug 14, 2026
Merged

TST: cover controller behavior and reporting#1152
Gui-FernandesBR merged 1 commit into
RocketPy-Team:developfrom
ting-hong-shieh:codex/test-controller-coverage

Conversation

@ting-hong-shieh

Copy link
Copy Markdown

Summary

Add focused unit coverage for controller state handling, reporting, and non-pickle serialization. The tests exercise observable behavior and complement the existing Flight integration coverage; they do not change production code.

This is a small contribution toward #709.

Coverage

Both measurements used the same non-slow unit, integration, and acceptance suite, followed by the RocketPy doctests.

Scope Base cb6106a717207dd8fc2dfe1446d80ff75022f21b Head 5a205109a6989a569d20e8ec448eba8c71c6ae1e
rocketpy/control/controller.py 54/63 (85.71%) 63/63 (100.00%)
rocketpy/prints/controller_prints.py 7/24 (29.17%) 22/24 (91.67%)
Entire rocketpy package 13,810/17,080 (80.8548%) 13,834/17,080 (80.9953%)

The new tests cover 24 previously missed statements. They verify:

  • preservation of the initial observation and appending of each controller return value;
  • discrete and continuous controller descriptions;
  • reporting for one and multiple interactive objects;
  • non-pickle serialization of the function name and interactive-object hashes; and
  • restoration when from_dict() receives an existing callable.

Verification

$ pytest tests \
    --deselect tests/integration/test_plots.py::test_flight_animations_run_off_screen \
    --deselect tests/integration/test_plots.py::test_flight_animations_render_all_scene_options \
    --deselect tests/integration/test_plots.py::test_flight_animation_export_gif \
    --cov=rocketpy --cov-report=
2193 passed, 53 skipped, 3 deselected

$ pytest rocketpy --doctest-modules --cov=rocketpy --cov-append --cov-report=
48 passed

$ pytest tests/unit/control/test_controller.py \
    tests/unit/simulation/test_flight_time_nodes.py \
    tests/integration/simulation/test_flight.py -k controller
13 passed, 34 deselected

$ ruff check tests/unit/control/test_controller.py
All checks passed!

$ ruff format --check tests/unit/control/test_controller.py
1 file already formatted

The three PyVista animation tests were excluded locally because the first off-screen render terminated the local VTK process with a segmentation fault. The repository workflow already runs those three tests as a separate retrying step; the PR does not modify animation code.

Environment

  • macOS 26.5.2, arm64
  • Python 3.12.6
  • RocketPy 1.13.0
  • NumPy 2.5.2
  • SciPy 1.18.0
  • pytest 9.1.1
  • Ruff 0.16.3

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.45%. Comparing base (e0ff281) to head (e174742).
⚠️ Report is 59 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1152      +/-   ##
===========================================
+ Coverage    82.18%   83.45%   +1.26%     
===========================================
  Files          122      130       +8     
  Lines        16355    17082     +727     
===========================================
+ Hits         13441    14255     +814     
+ Misses        2914     2827      -87     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ting-hong-shieh
ting-hong-shieh marked this pull request as ready for review August 14, 2026 03:22
@ting-hong-shieh
ting-hong-shieh requested a review from a team as a code owner August 14, 2026 03:22

@Gui-FernandesBR Gui-FernandesBR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it really increase the test coverage? How many lines?

@Gui-FernandesBR Gui-FernandesBR linked an issue Aug 14, 2026 that may be closed by this pull request
@Gui-FernandesBR
Gui-FernandesBR force-pushed the codex/test-controller-coverage branch from 5a20510 to e174742 Compare August 14, 2026 10:06
@Gui-FernandesBR
Gui-FernandesBR merged commit 62aa0f9 into RocketPy-Team:develop Aug 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST: Increase code coverage to 90%

2 participants