Skip to content

Commit fa550ed

Browse files
committed
test(zip for forum): Prevent opening file explorers during CI tests.
Added an autouse=True fixture that mocks _open_file_explorer_and_select to prevent it from actually trying to open file explorers during tests. This is similar to the existing mock_webbrowser_open_url fixture that was already in place to prevent browser opening during tests.
1 parent 56e6298 commit fa550ed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/acceptance_zip_for_forum_help.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ def mock_webbrowser_open_url() -> Iterator[MagicMock]:
7676
yield mock_browser
7777

7878

79+
@pytest.fixture(autouse=True)
80+
def mock_open_file_explorer() -> Iterator[MagicMock]:
81+
"""Prevent tests from opening file explorer which blocks in CI without a display."""
82+
with patch(
83+
"ardupilot_methodic_configurator.data_model_parameter_editor.ParameterEditor._open_file_explorer_and_select",
84+
autospec=True,
85+
) as mock_explorer:
86+
yield mock_explorer
87+
88+
7989
def get_filesystem(parameter_editor: ParameterEditor) -> LocalFilesystem:
8090
"""Helper to access the underlying filesystem with relaxed typing."""
8191
return parameter_editor._local_filesystem

0 commit comments

Comments
 (0)