File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,22 @@ def _patch_simplestreams():
127127 sys .modules ["simplestreams.objectstores" ] = simplestreams .objectstores
128128
129129
130+ def _patch_pypureomapi ():
131+ """Patch pypureomapi module so imports succeed without the package installed."""
132+ import sys
133+ from unittest .mock import MagicMock
134+
135+ pypureomapi = MagicMock ()
136+ pypureomapi .Omapi = MagicMock ()
137+ pypureomapi .OMAPI_OP_STATUS = MagicMock ()
138+ pypureomapi .OMAPI_OP_UPDATE = MagicMock ()
139+ pypureomapi .OmapiError = MagicMock ()
140+ pypureomapi .OmapiMessage = MagicMock ()
141+ pypureomapi .pack_ip = MagicMock ()
142+
143+ sys .modules ["pypureomapi" ] = pypureomapi
144+
145+
130146def generate_api_description_from_source ():
131147 if "DJANGO_SETTINGS_MODULE" not in os .environ :
132148 os .environ .setdefault (
@@ -156,6 +172,7 @@ def get_openapi_spec() -> dict[str, str | Any]:
156172 _patch_curtin ()
157173 _patch_tftp ()
158174 _patch_simplestreams ()
175+ _patch_pypureomapi ()
159176 return generate_api_description_from_source ()
160177
161178
You can’t perform that action at this time.
0 commit comments