Skip to content

Conversation

Copy link

Copilot AI commented Dec 8, 2025

Pull request type

  • Code maintenance (refactoring, formatting, tests)

Checklist

  • Tests for the changes have been added (if needed)
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally

Current behavior

No acceptance tests exist for 3DOF flight simulation feature. Integration tests exist but lack end-to-end validation with realistic scenarios.

New behavior

Adds comprehensive acceptance test suite (tests/acceptance/test_3dof_flight.py) with 12 tests covering:

  • Trajectory validation: Apogee, velocity, flight time within expected ranges
  • Energy conservation: Kinetic/potential energy behavior through flight phases
  • Weathercocking: Attitude evolution with coefficients 0.0, 0.5, 1.0, 2.0
  • Mass variation: Propellant consumption and post-burnout behavior
  • Reproducibility: Identical inputs yield identical outputs

Tests use realistic fixtures (127mm rocket, 1500N thrust, 3.5s burn) and gracefully skip when PointMassMotor/PointMassRocket are unavailable. Will auto-activate when #882 merges.

Fixture Organization: All 3DOF-specific fixtures have been centralized in tests/fixtures/flight/flight_fixtures.py for better reusability:

  • acceptance_point_mass_motor: Realistic point mass motor fixture
  • acceptance_point_mass_rocket: Point mass rocket fixture
  • flight_3dof_no_weathercock: 3DOF flight without weathercocking
  • flight_3dof_with_weathercock: 3DOF flight with weathercocking enabled

The fixtures reuse existing example_spaceport_env from environment_fixtures.py instead of creating duplicate environment fixtures.

Example test structure:

def test_3dof_weathercocking_affects_trajectory(
    flight_3dof_no_weathercock, flight_3dof_with_weathercock
):
    apogee_no_wc = flight_no_wc.apogee - flight_no_wc.env.elevation
    apogee_with_wc = flight_with_wc.apogee - flight_with_wc.env.elevation
    assert abs(apogee_no_wc - apogee_with_wc) > 0.1

Breaking change

  • No

Additional information

Tests currently skip due to missing 3DOF classes. All existing acceptance tests (bella_lui, ndrt_2020, prometheus) pass unchanged. CodeQL: 0 alerts.

Fixtures have been properly organized following the project's pattern of centralizing test fixtures in tests/fixtures/ directory, improving code maintainability and reusability.

Original prompt

create a new branch: tst/3dof-acceptance-test which implements and solves the following Issue: #887. Also open a new PR with base branch as develop.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 8, 2025 06:32
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
@aZira371 aZira371 changed the base branch from master to develop December 8, 2025 06:38
Copilot AI changed the title [WIP] Implement 3DOF acceptance test TST: Add acceptance tests for 3DOF flight simulation Dec 8, 2025
Copilot AI requested a review from aZira371 December 8, 2025 06:45
@aZira371
Copy link
Collaborator

aZira371 commented Dec 8, 2025

@copilot Please check if the fixtures from flight_fixtures.py can be reused for these tests or not. If yes then reuse them here. If not then add new fixtures to the flight_fixtures.py file.

…onment fixture

Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 8, 2025

@copilot Please check if the fixtures from flight_fixtures.py can be reused for these tests or not. If yes then reuse them here. If not then add new fixtures to the flight_fixtures.py file.

Done! I've refactored the fixtures as requested:

Changes made (commit c6cbc90):

  • ✅ Removed acceptance_environment fixture from test file
  • ✅ Now reusing existing example_spaceport_env from environment_fixtures.py
  • ✅ Moved all 3DOF-specific fixtures to flight_fixtures.py:
    • acceptance_point_mass_motor
    • acceptance_point_mass_rocket
    • flight_3dof_no_weathercock
    • flight_3dof_with_weathercock

Results:

  • Test file reduced from 545 to 441 lines
  • All fixtures now centralized in flight_fixtures.py for better reusability
  • Fixtures use conditional import so they only load when 3DOF classes are available

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.

2 participants