@@ -59,14 +59,14 @@ def run_command(command):
5959 return None
6060
6161
62- def _unpack_archive (tarball_path : str , dst_path : str ):
62+ def _unpack_archive (tarball_path : Path , dst_path : Path ):
6363 logging .info (f"Extracting archive { tarball_path } " )
64- with tarfile .open (tarball_path , 'r:*' ) as tar :
65- tar .extractall (path = dst_path , filter = 'fully_trusted' )
64+ with tarfile .open (str ( tarball_path ) , 'r:*' ) as tar :
65+ tar .extractall (path = str ( dst_path ) , filter = 'fully_trusted' )
6666
6767
68- def _parse_archive_path (archive_path : str ) -> Tuple [str , str ]:
69- archive_name = os . path . basename ( archive_path )
68+ def _parse_archive_path (archive_path : Path ) -> Tuple [str , str ]:
69+ archive_name = archive_path . name
7070
7171 # Removes the last extension (e.g., .gz)
7272 base_name = Path (archive_name ).stem
@@ -89,23 +89,23 @@ def _parse_archive_path(archive_path: str) -> Tuple[str, str]:
8989 return base_name , major_minor
9090
9191
92- def prepare_test_directory (archive_path : str , tests_path : str ) :
92+ def prepare_test_directory (archive_path : Path , tests_path : Path ) -> Tuple [ Path , str ] :
9393
9494 base_name , major_minor = _parse_archive_path (archive_path )
9595 # The archive contains a folder with the same name as the archive.
9696 # We are interested in the contents within that folder, as thats where
9797 # the files are.
98- files_path = os . path . join ( tests_path , base_name )
98+ files_path = tests_path / base_name
9999
100100 # Cleanup any previous run.
101101 shutil .rmtree (files_path , ignore_errors = True )
102102
103103 # Create the test directory.
104- Path ( tests_path ) .mkdir (parents = True , exist_ok = True )
104+ tests_path .mkdir (parents = True , exist_ok = True )
105105
106106 _unpack_archive (archive_path , tests_path )
107107
108108 # Sanity check that the archive has maintained its format.
109- assert os . path . isdir ( files_path )
109+ assert files_path . is_dir ( )
110110
111111 return files_path , major_minor
0 commit comments