33import  json 
44import  os 
55import  shutil 
6+ import  sys 
67import  tempfile 
78from  pathlib  import  Path 
89
910import  pytest 
1011from  git  import  Repo 
1112from  pytest_httpx ._httpx_mock  import  HTTPXMock 
12- from  typer .testing  import  Any ,  CliRunner 
13+ from  typer .testing  import  CliRunner 
1314
1415from  infrahub_sdk .ctl .cli_commands  import  app 
15- 
16- from  .utils  import  change_directory , strip_color 
16+ from  tests .helpers .utils  import  change_directory , strip_color 
1717
1818runner  =  CliRunner ()
1919
2020
21- FIXTURE_BASE_DIR  =  Path (Path (os .path .abspath (__file__ )).parent  /  ".."  /  "fixtures"  /  "integration"  /  "test_infrahubctl" )
21+ FIXTURE_BASE_DIR  =  Path (
22+     Path (os .path .abspath (__file__ )).parent  /  ".."  /  ".."  /  "fixtures"  /  "integration"  /  "test_infrahubctl" 
23+ )
2224
2325
24- def  read_fixture (file_name : str , fixture_subdir : str  =  "." ) ->  Any :
26+ def  read_fixture (file_name : str , fixture_subdir : str  =  "." ) ->  str :
2527    """Read the contents of a fixture.""" 
2628    with  Path (FIXTURE_BASE_DIR  /  fixture_subdir  /  file_name ).open ("r" , encoding = "utf-8" ) as  fhd :
2729        fixture_contents  =  fhd .read ()
@@ -38,7 +40,7 @@ def tags_transform_dir():
3840        shutil .copytree (fixture_path , temp_dir , dirs_exist_ok = True )
3941        # Initialize fixture as git repo. This is necessary to run some infrahubctl commands. 
4042        with  change_directory (temp_dir ):
41-             Repo .init ("." )
43+             Repo .init ("." ,  initial_branch = "main" )
4244
4345        yield  temp_dir 
4446
@@ -64,6 +66,7 @@ def test_transform_not_exist_in_infrahub_yml(tags_transform_dir: str) -> None:
6466            assert  output .exit_code  ==  1 
6567
6668    @staticmethod  
69+     @pytest .mark .skipif (sys .version_info  <  (3 , 10 ), reason = "requires python3.10 or higher" ) 
6770    def  test_transform_python_file_not_defined (tags_transform_dir : str ) ->  None :
6871        """Case transform python file not defined.""" 
6972        # Remove transform file 
@@ -78,6 +81,7 @@ def test_transform_python_file_not_defined(tags_transform_dir: str) -> None:
7881            assert  output .exit_code  ==  1 
7982
8083    @staticmethod  
84+     @pytest .mark .skipif (sys .version_info  <  (3 , 10 ), reason = "requires python3.10 or higher" ) 
8185    def  test_transform_python_class_not_defined (tags_transform_dir : str ) ->  None :
8286        """Case transform python class not defined.""" 
8387        # Rename transform inside of python file so the class name searched for no longer exists 
@@ -97,6 +101,7 @@ def test_transform_python_class_not_defined(tags_transform_dir: str) -> None:
97101            assert  output .exit_code  ==  1 
98102
99103    @staticmethod  
104+     @pytest .mark .skipif (sys .version_info  <  (3 , 10 ), reason = "requires python3.10 or higher" ) 
100105    def  test_gql_query_not_defined (tags_transform_dir : str ) ->  None :
101106        """Case GraphQL Query is not defined""" 
102107        # Remove GraphQL Query file 
@@ -110,6 +115,7 @@ def test_gql_query_not_defined(tags_transform_dir: str) -> None:
110115            assert  output .exit_code  ==  1 
111116
112117    @staticmethod  
118+     @pytest .mark .skipif (sys .version_info  <  (3 , 10 ), reason = "requires python3.10 or higher" ) 
113119    def  test_infrahubctl_transform_cmd_success (httpx_mock : HTTPXMock , tags_transform_dir : str ) ->  None :
114120        """Case infrahubctl transform command executes successfully""" 
115121        httpx_mock .add_response (
0 commit comments