99import pytest
1010from git import Repo
1111from pytest_httpx ._httpx_mock import HTTPXMock
12- from typer .testing import Any , CliRunner
12+ from typer .testing import CliRunner
1313
1414from infrahub_sdk .ctl .cli_commands import app
15-
16- from .utils import change_directory , strip_color
15+ from tests .helpers .utils import change_directory , strip_color
1716
1817runner = CliRunner ()
1918
2019
21- FIXTURE_BASE_DIR = Path (Path (os .path .abspath (__file__ )).parent / ".." / "fixtures" / "integration" / "test_infrahubctl" )
20+ FIXTURE_BASE_DIR = Path (
21+ Path (os .path .abspath (__file__ )).parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl"
22+ )
2223
2324
24- def read_fixture (file_name : str , fixture_subdir : str = "." ) -> Any :
25+ def read_fixture (file_name : str , fixture_subdir : str = "." ) -> str :
2526 """Read the contents of a fixture."""
2627 with Path (FIXTURE_BASE_DIR / fixture_subdir / file_name ).open ("r" , encoding = "utf-8" ) as fhd :
2728 fixture_contents = fhd .read ()
@@ -38,7 +39,7 @@ def tags_transform_dir():
3839 shutil .copytree (fixture_path , temp_dir , dirs_exist_ok = True )
3940 # Initialize fixture as git repo. This is necessary to run some infrahubctl commands.
4041 with change_directory (temp_dir ):
41- Repo .init ("." )
42+ Repo .init ("." , initial_branch = "main" )
4243
4344 yield temp_dir
4445
@@ -64,6 +65,7 @@ def test_transform_not_exist_in_infrahub_yml(tags_transform_dir: str) -> None:
6465 assert output .exit_code == 1
6566
6667 @staticmethod
68+ @pytest .mark .xfail (reason = "Seems problematic in Python 3.9" )
6769 def test_transform_python_file_not_defined (tags_transform_dir : str ) -> None :
6870 """Case transform python file not defined."""
6971 # Remove transform file
@@ -78,6 +80,7 @@ def test_transform_python_file_not_defined(tags_transform_dir: str) -> None:
7880 assert output .exit_code == 1
7981
8082 @staticmethod
83+ @pytest .mark .xfail (reason = "Seems problematic in Python 3.9" )
8184 def test_transform_python_class_not_defined (tags_transform_dir : str ) -> None :
8285 """Case transform python class not defined."""
8386 # Rename transform inside of python file so the class name searched for no longer exists
@@ -97,6 +100,7 @@ def test_transform_python_class_not_defined(tags_transform_dir: str) -> None:
97100 assert output .exit_code == 1
98101
99102 @staticmethod
103+ @pytest .mark .xfail (reason = "Seems problematic in Python 3.9" )
100104 def test_gql_query_not_defined (tags_transform_dir : str ) -> None :
101105 """Case GraphQL Query is not defined"""
102106 # Remove GraphQL Query file
@@ -110,6 +114,7 @@ def test_gql_query_not_defined(tags_transform_dir: str) -> None:
110114 assert output .exit_code == 1
111115
112116 @staticmethod
117+ @pytest .mark .xfail (reason = "Seems problematic in Python 3.9" )
113118 def test_infrahubctl_transform_cmd_success (httpx_mock : HTTPXMock , tags_transform_dir : str ) -> None :
114119 """Case infrahubctl transform command executes successfully"""
115120 httpx_mock .add_response (
0 commit comments