RocketPy icon indicating copy to clipboard operation
RocketPy copied to clipboard

MNT: Refactor Tank's testing Assertion with CAD data.

Open phmbressan opened this issue 1 year ago • 1 comments

Pull request type

  • [X] Code maintenance (refactoring, formatting, tests)

Checklist

  • [X] Tests for the changes have been added (if needed)
  • [X] Lint (black rocketpy/ tests/) has passed locally
  • [X] All tests (pytest tests -m slow --runslow) have passed locally
  • [X] CHANGELOG.md has been updated (if relevant)

Current behavior

Currently the Tank's testing module present the following issues:

  • The module has too complex logic inside the tests;
  • There are analytical functions that perform geometrical validation:
    • Those, even if correct, are hard to maintain and may, for instance, repeat mistakes from the code.

New behavior

This PR aims to bring the following changes to code:

  • CAD related data by cadquery module for geometrical validation;
  • Refactor of the complex logic inside the Tanks tests;
    • There is still room for improvement here, but the code is better organized now.
  • Implement plotting and printing functionality to the Tanks class (this can be moved to another PR if needed).

Breaking change

  • [ ] Yes
  • [X] No

Additional information

Check out CadQuery docs for further information and examples.

An important notice is that the CAD module is not executed in every test for the two reasons:

  • The CAD library has a large install size (> 200MB);
  • Some models are slow to be used in parametrized tests.

Therefore I have added the necessary code into a Jupyter notebook for easy recalculation of the expected values, but this can be discussed further on this PR.

P.S.: I will fix the PyLint errors shortly.

phmbressan avatar Aug 30 '24 21:08 phmbressan

Codecov Report

Attention: Patch coverage is 96.90722% with 3 lines in your changes missing coverage. Please review.

Project coverage is 76.43%. Comparing base (e1a2061) to head (e6dec5b). Report is 26 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/plots/tank_geometry_plots.py 0.00% 3 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #678      +/-   ##
===========================================
+ Coverage    75.99%   76.43%   +0.44%     
===========================================
  Files           95       95              
  Lines        11015    11078      +63     
===========================================
+ Hits          8371     8468      +97     
+ Misses        2644     2610      -34     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 30 '24 21:08 codecov[bot]

a few tests are not passing locally...

Thanks for testing it. I will check what is happening.

phmbressan avatar Nov 14 '24 07:11 phmbressan