Skip to content

Commit 1f18022

Browse files
bosdbosd
authored andcommitted
Fix import location for _show_warning_panel to comply with PEP 8
- Move local import of _show_warning_panel to module level for consistency - Update mock fixture to patch at correct location (preflight module instead of ui module) - Maintain all existing functionality while following Python best practices - All tests continue to pass (376/376)
1 parent cb5a22c commit 1f18022

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/odoo_data_flow/lib/preflight.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ..logging_config import log
1818
from . import cache, conf_lib, sort
1919
from .actions import language_installer
20-
from .internal.ui import _show_error_panel
20+
from .internal.ui import _show_error_panel, _show_warning_panel
2121

2222
# A registry to hold all pre-flight check functions
2323
PREFLIGHT_CHECKS: list[Callable[..., bool]] = []
@@ -360,8 +360,6 @@ def _validate_header(
360360

361361
# Warn about readonly fields, especially non-stored ones
362362
if readonly_fields:
363-
from .internal.ui import _show_warning_panel
364-
365363
warning_message = (
366364
"The following readonly fields will be silently ignored during import:\n"
367365
)

tests/test_preflight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def mock_cache() -> Generator[MagicMock, None, None]:
4545
@pytest.fixture
4646
def mock_show_warning_panel() -> Generator[MagicMock, None, None]:
4747
"""Fixture to mock _show_warning_panel."""
48-
with patch("odoo_data_flow.lib.internal.ui._show_warning_panel") as mock_panel:
48+
with patch("odoo_data_flow.lib.preflight._show_warning_panel") as mock_panel:
4949
yield mock_panel
5050

5151

0 commit comments

Comments
 (0)