Skip to content

Commit c66eb32

Browse files
Instantiate the transform/check classes. Temporary fix.
1 parent f99a19e commit c66eb32

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

infrahub_sdk/pytest_plugin/items/check.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ def instantiate_check(self) -> None:
3737
str(self.resource_config.file_path.parent) if self.resource_config.file_path.parent != Path() else None # type: ignore[attr-defined]
3838
)
3939

40-
self.check_instance = self.resource_config.load_class( # type: ignore[attr-defined]
40+
check_class = self.resource_config.load_class( # type: ignore[attr-defined]
4141
import_root=self.repository_base, relative_path=relative_path
4242
)
43+
client = self.session.infrahub_client # type: ignore[attr-defined]
44+
self.check_instance = check_class(branch=client.default_branch, client=client)
4345

4446
def run_check(self, variables: dict[str, Any]) -> Any:
4547
self.instantiate_check()

infrahub_sdk/pytest_plugin/items/python_transform.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ def instantiate_transform(self) -> None:
3636
relative_path = (
3737
str(self.resource_config.file_path.parent) if self.resource_config.file_path.parent != Path() else None # type: ignore[attr-defined]
3838
)
39-
self.transform_instance = self.resource_config.load_class( # type: ignore[attr-defined]
39+
transform_class = self.resource_config.load_class( # type: ignore[attr-defined]
4040
import_root=self.repository_base, relative_path=relative_path
4141
)
42+
client = self.session.infrahub_client # type: ignore[attr-defined]
43+
self.transform_instance = transform_class(branch=client.default_branch, client=client)
4244

4345
def run_transform(self, variables: dict[str, Any]) -> Any:
4446
self.instantiate_transform()

0 commit comments

Comments
 (0)