Skip to content

Recovery - #1941

Open
amilcarlucas wants to merge 1 commit into
masterfrom
recovery
Open

Recovery#1941
amilcarlucas wants to merge 1 commit into
masterfrom
recovery

fix(motor-test): recover unsupported FRAME_TYPE values and refresh UI…

35a8852
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
GitHub Actions / Test Results failed Aug 28, 2026 in 0s

3 fail, 7 skipped, 4 854 pass in 45m 58s

     4 files  ±  0       4 suites  ±0   45m 58s ⏱️ + 1m 21s
 4 864 tests +101   4 854 ✅ +101   7 💤 ±0   3 ❌ ±0 
19 238 runs  +404  19 181 ✅ +404  45 💤 ±0  12 ❌ ±0 

Results for commit 35a8852. ± Comparison against earlier commit 8d74c95.

Annotations

Check warning on line 0 in tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 4 runs failed: test_model_raises_error_with_empty_layouts (tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading)

artifacts/coverage-macos-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.10-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-windows-latest-3.14-xml/results-junit.xml [took 0s]
Raw output
Failed: DID NOT RAISE RuntimeError
self = <plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading object at 0x00000205D99A2FD0>
mock_flight_controller = <MagicMock spec='FlightController' id='2222720241008'>
mock_filesystem = <MagicMock id='2222720247728'>

    def test_model_raises_error_with_empty_layouts(self, mock_flight_controller, mock_filesystem) -> None:
        """
        Model raises RuntimeError when no matching frame layout is found.
    
        GIVEN: JSON data loads successfully but contains no matching frame layouts
        WHEN: User initializes the motor test data model
        THEN: Model should raise RuntimeError about missing frame configuration
        """
        # Arrange: Mock JSON loading with empty layouts
        mock_flight_controller.get_frame_info.return_value = (1, 1)  # QUAD_X frame
    
        with patch(
            "ardupilot_methodic_configurator.plugins.data_model_motor_test.FilesystemJSONWithSchema"
        ) as mock_json_class:
            mock_loader = MagicMock()
            mock_loader.load_json_data.return_value = {"layouts": []}
            mock_loader.data = mock_loader.load_json_data.return_value
            mock_json_class.return_value = mock_loader
    
            # Act & Assert: Initialize model should raise RuntimeError
>           with pytest.raises(RuntimeError, match="No motor configuration found for frame class 1 and type 1"):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           Failed: DID NOT RAISE RuntimeError

tests\plugins\test_data_model_motor_test.py:1699: Failed

Check warning on line 0 in tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 4 runs failed: test_model_handles_json_loading_failure_gracefully (tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading)

artifacts/coverage-macos-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.10-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-windows-latest-3.14-xml/results-junit.xml [took 0s]
Raw output
Failed: DID NOT RAISE RuntimeError
self = <plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading object at 0x00000205D9963790>
mock_flight_controller = <MagicMock spec='FlightController' id='2222720243696'>
mock_filesystem = <MagicMock id='2222715155328'>

    def test_model_handles_json_loading_failure_gracefully(self, mock_flight_controller, mock_filesystem) -> None:
        """
        Model raises RuntimeError when JSON loading fails.
    
        GIVEN: JSON loading fails due to file or validation errors
        WHEN: User initializes the motor test data model
        THEN: Model should raise RuntimeError since no frame configuration can be found
        """
        # Arrange: Mock JSON loading failure
        mock_flight_controller.get_frame_info.return_value = (1, 1)  # QUAD_X frame
    
        with patch(
            "ardupilot_methodic_configurator.plugins.data_model_motor_test.FilesystemJSONWithSchema"
        ) as mock_json_class:
            mock_loader = MagicMock()
            mock_loader.load_json_data.side_effect = Exception("JSON loading failed")
            mock_loader.data = None  # When loading fails, data is None
            mock_json_class.return_value = mock_loader
    
            # Act & Assert: Initialize model should raise RuntimeError
>           with pytest.raises(RuntimeError, match="No motor configuration found for frame class 1 and type 1"):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           Failed: DID NOT RAISE RuntimeError

tests\plugins\test_data_model_motor_test.py:1773: Failed

Check warning on line 0 in tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 4 runs failed: test_model_handles_empty_json_response_appropriately (tests.plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading)

artifacts/coverage-macos-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.10-xml/results-junit.xml [took 0s]
artifacts/coverage-ubuntu-latest-3.14-xml/results-junit.xml [took 0s]
artifacts/coverage-windows-latest-3.14-xml/results-junit.xml [took 0s]
Raw output
Failed: DID NOT RAISE RuntimeError
self = <plugins.test_data_model_motor_test.TestMotorTestDataModelJSONLoading object at 0x00000205D99638A0>
mock_flight_controller = <MagicMock spec='FlightController' id='2222720245712'>
mock_filesystem = <MagicMock id='2222707843360'>

    def test_model_handles_empty_json_response_appropriately(self, mock_flight_controller, mock_filesystem) -> None:
        """
        Model raises RuntimeError when JSON loading returns empty data.
    
        GIVEN: JSON loading returns empty data structure
        WHEN: User initializes the motor test data model
        THEN: Model should raise RuntimeError since no frame configuration can be found
        """
        # Arrange: Mock empty JSON response
        mock_flight_controller.get_frame_info.return_value = (1, 1)  # QUAD_X frame
    
        with patch(
            "ardupilot_methodic_configurator.plugins.data_model_motor_test.FilesystemJSONWithSchema"
        ) as mock_json_class:
            mock_loader = MagicMock()
            mock_loader.load_json_data.return_value = {}
            mock_loader.data = {}  # Empty data
            mock_json_class.return_value = mock_loader
    
            # Act & Assert: Initialize model should raise RuntimeError
>           with pytest.raises(RuntimeError, match="No motor configuration found for frame class 1 and type 1"):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           Failed: DID NOT RAISE RuntimeError

tests\plugins\test_data_model_motor_test.py:1796: Failed