Skip to content

Commit 34ad32e

Browse files
nickandersonclaude
andcommitted
test: add ModuleBase mocking for appstreams unit tests
Mock dnf.module.module_base to support testing the ModuleBase API refactoring. Without this mock, the import sets dnf.module=None and tests fail when trying to access module_base.ModuleBase(). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a5fbcab commit 34ad32e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

promise-types/appstreams/test_appstreams_logic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
# Mock dnf module before importing the promise module
1414
mock_dnf = MagicMock()
1515
mock_dnf.exceptions = MagicMock()
16+
mock_dnf.module = MagicMock()
17+
mock_dnf.module.module_base = MagicMock()
1618
sys.modules["dnf"] = mock_dnf
1719
sys.modules["dnf.exceptions"] = mock_dnf.exceptions
20+
sys.modules["dnf.module"] = mock_dnf.module
21+
sys.modules["dnf.module.module_base"] = mock_dnf.module.module_base
1822

1923
import appstreams as appstreams_module # noqa: E402
2024

0 commit comments

Comments
 (0)