We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc61aff commit a2a28e0Copy full SHA for a2a28e0
infrahub_sdk/checks.py
@@ -189,6 +189,12 @@ def get_check_class_instance(
189
try:
190
spec = importlib.util.spec_from_file_location(check_config.class_name, search_location)
191
module = importlib.util.module_from_spec(spec) # type: ignore[arg-type]
192
+
193
+ # Set base module for relative import. This is useful when pytest plugin runs through proposed change pipeline,
194
+ # as pytest is invoked outside of the imported repository.
195
+ # Note that using __package__ logs a `DeprecationWarning: __package__ != __spec__.parent`
196
+ module.__package__ = str(search_location.parent.name)
197
198
spec.loader.exec_module(module) # type: ignore[union-attr]
199
200
# Get the specified class from the module
0 commit comments