Skip to content

Conversation

@amilcarlucas
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 24, 2026 13:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses test regressions by removing outdated tests, configuring warning filters, consolidating type checker configuration, and adjusting Python version support for CI testing.

Changes:

  • Removed obsolete TestParameterAdditionWorkflows test class that was testing an old implementation of parameter addition workflows
  • Added matplotlib deprecation warning filter to pytest.ini to suppress noisy warnings during test runs
  • Removed redundant pyrightconfig.json file since pyright configuration already exists in pyproject.toml
  • Added extensive file exclusion lists to ruff and pyright configurations in pyproject.toml
  • Changed CI testing from Python 3.9/3.14/3.14t to Python 3.9/3.13

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_frontend_tkinter_parameter_editor_table.py Removes outdated test class that was testing an old implementation of parameter addition dialog
pytest.ini Adds deprecation warning filter for matplotlib to reduce test output noise
pyrightconfig.json Completely removes file as configuration is consolidated in pyproject.toml
pyproject.toml Adds extensive exclusion lists for both ruff linting and pyright type checking
.github/workflows/pytest.yml Changes Python versions tested in CI from 3.9/3.14/3.14t to 3.9/3.13

Comment on lines 2224 to 2226


class TestParameterAdditionWorkflows:
"""Cover add-parameter dialog flows and error handling."""

def test_on_parameter_add_invokes_confirmation_handler(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.get_possible_add_param_names.return_value = ["NEW"]
parameter_editor_table._confirm_parameter_addition = MagicMock(return_value=True)
mock_window = MagicMock()
mock_window.root = MagicMock()
mock_window.main_frame = MagicMock()
entry_widget = MagicMock()
entry_widget.get.return_value = "NEW"

with (
patch(
"ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_table.BaseWindow", return_value=mock_window
),
patch(
"ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_table.EntryWithDynamicalyFilteredListbox",
return_value=entry_widget,
),
):
parameter_editor_table._on_parameter_add()

handler = entry_widget.bind.call_args_list[0][0][1]
handler(SimpleNamespace(widget=entry_widget))
parameter_editor_table._confirm_parameter_addition.assert_called_with("NEW")

def test_on_parameter_add_handles_operation_not_possible(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.get_possible_add_param_names.side_effect = OperationNotPossibleError("nope")
parameter_editor_table._on_parameter_add()
parameter_editor_table._dialogs.show_error.assert_called_once()

def test_confirm_parameter_addition_handles_errors(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.add_parameter_to_current_file.side_effect = InvalidParameterNameError("bad")
assert parameter_editor_table._confirm_parameter_addition("bad") is False
parameter_editor_table._dialogs.show_error.assert_called()

parameter_editor_table._dialogs.show_error.reset_mock()
parameter_editor_table.parameter_editor.add_parameter_to_current_file.side_effect = OperationNotPossibleError("ops")
assert parameter_editor_table._confirm_parameter_addition("bad") is False
parameter_editor_table._dialogs.show_error.assert_called()


class TestUploadSelectionBehavior:
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The removed test test_confirm_parameter_addition_handles_errors was covering error handling for OperationNotPossibleError in the _confirm_parameter_addition() method. While other tests cover InvalidParameterNameError, there is no remaining test coverage for the OperationNotPossibleError exception handling at lines 982-984 of ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py.

This exception can be raised in certain scenarios (e.g., when operations are not possible due to system state), and the error handling should be tested to ensure users see appropriate error messages.

Copilot uses AI. Check for mistakes.
os: [ubuntu-latest]
python-version: ["3.9", "3.14", "3.14t"]
#python-version: ["3.9", "3.14", "3.14t"]
python-version: ["3.9", "3.13"]
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The PR removes testing for Python 3.14 and 3.14t, but the pyproject.toml file still declares support for Python 3.14 in the classifiers (line 39) and includes version-specific dependencies for Python 3.14 (lines 51-52). This creates an inconsistency where the project claims to support Python 3.14 but doesn't test it in CI.

Consider either:

  1. Removing Python 3.14 from the classifiers and version-specific dependencies in pyproject.toml if it's not officially supported yet
  2. Re-enabling Python 3.14 testing once the version is stable and available in GitHub Actions
Suggested change
python-version: ["3.9", "3.13"]
python-version: ["3.9", "3.13", "3.14", "3.14t"]

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +170
"scripts/test_gui_environment.py",
"svg_comparison_demo.py",
"scripts/show_svg_tk_variants.py",
"scripts/pycairo_render.py",
"scripts/cairosvg_test.py",
"scripts/cairo_svg_tkinter_demo.py",
"scripts/cairo_svg_renderer.py",
"post_install.py",
"param_zip.py",
"param_filter.py",
"mavproxy_param.py",
"mavproxy_ftp.py",
"mavftp.py",
"fix_with_statements.py",
"find_exclusive_parameter_names.py",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

These excluded files do not exist in the repository. Adding non-existent files to the exclusion list serves no purpose and can cause confusion. Consider removing these entries from the exclusion list:

  • scripts/test_gui_environment.py
  • svg_comparison_demo.py
  • scripts/show_svg_tk_variants.py
  • scripts/pycairo_render.py
  • scripts/cairosvg_test.py
  • scripts/cairo_svg_tkinter_demo.py
  • scripts/cairo_svg_renderer.py
  • post_install.py
  • param_zip.py
  • param_filter.py
  • mavproxy_param.py
  • mavproxy_ftp.py
  • mavftp.py
  • fix_with_statements.py
  • find_exclusive_parameter_names.py

Only exclude files that actually exist and need to be excluded from linting.

Suggested change
"scripts/test_gui_environment.py",
"svg_comparison_demo.py",
"scripts/show_svg_tk_variants.py",
"scripts/pycairo_render.py",
"scripts/cairosvg_test.py",
"scripts/cairo_svg_tkinter_demo.py",
"scripts/cairo_svg_renderer.py",
"post_install.py",
"param_zip.py",
"param_filter.py",
"mavproxy_param.py",
"mavproxy_ftp.py",
"mavftp.py",
"fix_with_statements.py",
"find_exclusive_parameter_names.py",

Copilot uses AI. Check for mistakes.
Comment on lines +308 to +322
"scripts/test_gui_environment.py",
"svg_comparison_demo.py",
"scripts/show_svg_tk_variants.py",
"scripts/pycairo_render.py",
"scripts/cairosvg_test.py",
"scripts/cairo_svg_tkinter_demo.py",
"scripts/cairo_svg_renderer.py",
"post_install.py",
"param_zip.py",
"param_filter.py",
"mavproxy_param.py",
"mavproxy_ftp.py",
"mavftp.py",
"fix_with_statements.py",
"find_exclusive_parameter_names.py",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

These excluded files do not exist in the repository. Adding non-existent files to the exclusion list serves no purpose and can cause confusion. Consider removing these entries from the exclusion list:

  • scripts/test_gui_environment.py
  • svg_comparison_demo.py
  • scripts/show_svg_tk_variants.py
  • scripts/pycairo_render.py
  • scripts/cairosvg_test.py
  • scripts/cairo_svg_tkinter_demo.py
  • scripts/cairo_svg_renderer.py
  • post_install.py
  • param_zip.py
  • param_filter.py
  • mavproxy_param.py
  • mavproxy_ftp.py
  • mavftp.py
  • fix_with_statements.py
  • find_exclusive_parameter_names.py

Only exclude files that actually exist and need to be excluded from type checking.

Suggested change
"scripts/test_gui_environment.py",
"svg_comparison_demo.py",
"scripts/show_svg_tk_variants.py",
"scripts/pycairo_render.py",
"scripts/cairosvg_test.py",
"scripts/cairo_svg_tkinter_demo.py",
"scripts/cairo_svg_renderer.py",
"post_install.py",
"param_zip.py",
"param_filter.py",
"mavproxy_param.py",
"mavproxy_ftp.py",
"mavftp.py",
"fix_with_statements.py",
"find_exclusive_parameter_names.py",

Copilot uses AI. Check for mistakes.
Comment on lines 2224 to 2226


class TestParameterAdditionWorkflows:
"""Cover add-parameter dialog flows and error handling."""

def test_on_parameter_add_invokes_confirmation_handler(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.get_possible_add_param_names.return_value = ["NEW"]
parameter_editor_table._confirm_parameter_addition = MagicMock(return_value=True)
mock_window = MagicMock()
mock_window.root = MagicMock()
mock_window.main_frame = MagicMock()
entry_widget = MagicMock()
entry_widget.get.return_value = "NEW"

with (
patch(
"ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_table.BaseWindow", return_value=mock_window
),
patch(
"ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_table.EntryWithDynamicalyFilteredListbox",
return_value=entry_widget,
),
):
parameter_editor_table._on_parameter_add()

handler = entry_widget.bind.call_args_list[0][0][1]
handler(SimpleNamespace(widget=entry_widget))
parameter_editor_table._confirm_parameter_addition.assert_called_with("NEW")

def test_on_parameter_add_handles_operation_not_possible(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.get_possible_add_param_names.side_effect = OperationNotPossibleError("nope")
parameter_editor_table._on_parameter_add()
parameter_editor_table._dialogs.show_error.assert_called_once()

def test_confirm_parameter_addition_handles_errors(self, parameter_editor_table: ParameterEditorTable) -> None:
parameter_editor_table.parameter_editor.add_parameter_to_current_file.side_effect = InvalidParameterNameError("bad")
assert parameter_editor_table._confirm_parameter_addition("bad") is False
parameter_editor_table._dialogs.show_error.assert_called()

parameter_editor_table._dialogs.show_error.reset_mock()
parameter_editor_table.parameter_editor.add_parameter_to_current_file.side_effect = OperationNotPossibleError("ops")
assert parameter_editor_table._confirm_parameter_addition("bad") is False
parameter_editor_table._dialogs.show_error.assert_called()


class TestUploadSelectionBehavior:
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The removed test test_on_parameter_add_handles_operation_not_possible was covering error handling for when get_possible_add_param_names() raises OperationNotPossibleError. However, the current implementation of _on_parameter_add() at line 903 of ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py does not have a try-catch block to handle this exception. This creates a test coverage gap for an important error scenario that can occur when there's no apm.pdef.xml file and no FC connected.

Consider either:

  1. Adding error handling to _on_parameter_add() to catch OperationNotPossibleError and show an appropriate error dialog
  2. Adding a test to verify that the application handles this error gracefully

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11051 10085 91% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 3e19890 by action🐍

@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2026

Test Results

    3 files      3 suites   34m 4s ⏱️
2 912 tests 2 905 ✅  7 💤 0 ❌
8 736 runs  8 715 ✅ 21 💤 0 ❌

Results for commit 3e19890.

♻️ This comment has been updated with latest results.

@amilcarlucas amilcarlucas force-pushed the fix_test_regressions branch 2 times, most recently from 12a9eb7 to 5ad6ec9 Compare January 24, 2026 19:11
…g in the repository

- unify pyright configuration
- ignore some matplotlib deprecation warnings
This should be reverted and improved upon at some point, but for now just fix it
@amilcarlucas amilcarlucas merged commit 44f4f53 into master Jan 24, 2026
31 checks passed
@amilcarlucas amilcarlucas deleted the fix_test_regressions branch January 24, 2026 20:09
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