1919
2020@dataclass (frozen = True )
2121class DownloadedDataset :
22- """Metadata for the downloaded logs used for integration tests ."""
22+ """Metadata for a dataset downloaded on-demand from an external URL ."""
2323
2424 #:
25- name : str
25+ dataset_name : str
2626 #:
2727 tarball_url : str
2828 integration_test_path_config : InitVar [IntegrationTestPathConfig ]
@@ -35,16 +35,16 @@ class DownloadedDataset:
3535
3636 def __post_init__ (self , integration_test_path_config : IntegrationTestPathConfig ) -> None :
3737 """Initialize and set tarball and extraction paths for integration test logs."""
38- name = self .name .strip ()
39- if 0 == len (name ):
40- err_msg = "`name ` cannot be empty."
38+ dataset_name = self .dataset_name .strip ()
39+ if 0 == len (dataset_name ):
40+ err_msg = "`dataset_name ` cannot be empty."
4141 raise ValueError (err_msg )
4242 downloaded_logs_dir = integration_test_path_config .downloaded_logs_dir
4343 validate_dir_exists (downloaded_logs_dir )
4444
45- object .__setattr__ (self , "name " , name )
46- object .__setattr__ (self , "tarball_path" , downloaded_logs_dir / f"{ name } .tar.gz" )
47- object .__setattr__ (self , "extraction_dir" , downloaded_logs_dir / name )
45+ object .__setattr__ (self , "dataset_name " , dataset_name )
46+ object .__setattr__ (self , "tarball_path" , downloaded_logs_dir / f"{ dataset_name } .tar.gz" )
47+ object .__setattr__ (self , "extraction_dir" , downloaded_logs_dir / dataset_name )
4848
4949
5050@pytest .fixture (scope = "session" )
@@ -56,7 +56,7 @@ def hive_24hr(
5656 return _download_and_extract_gzip_dataset (
5757 request = request ,
5858 integration_test_path_config = integration_test_path_config ,
59- name = "hive-24hr" ,
59+ dataset_name = "hive-24hr" ,
6060 tarball_url = "https://zenodo.org/records/7094921/files/hive-24hr.tar.gz?download=1" ,
6161 )
6262
@@ -70,15 +70,15 @@ def postgresql(
7070 return _download_and_extract_gzip_dataset (
7171 request = request ,
7272 integration_test_path_config = integration_test_path_config ,
73- name = "postgresql" ,
73+ dataset_name = "postgresql" ,
7474 tarball_url = "https://zenodo.org/records/10516402/files/postgresql.tar.gz?download=1" ,
7575 )
7676
7777
7878def _download_and_extract_gzip_dataset (
7979 request : pytest .FixtureRequest ,
8080 integration_test_path_config : IntegrationTestPathConfig ,
81- name : str ,
81+ dataset_name : str ,
8282 tarball_url : str ,
8383 keep_leading_dir : bool = False ,
8484) -> DownloadedDataset :
@@ -88,20 +88,20 @@ def _download_and_extract_gzip_dataset(
8888
8989 :param request: Provides access to the pytest cache.
9090 :param integration_test_path_config: See `IntegrationTestPathConfig`.
91- :param name : Dataset name.
91+ :param dataset_name : Dataset name.
9292 :param tarball_url: Dataset tarball URL.
9393 :param keep_leading_dir: Whether to preserve the top-level directory during tarball extraction.
9494 Defaults to False to avoid an unnecessary extra directory level.
9595 :return: A DownloadedDataset instance providing metadata for the downloaded logs.
9696 :raises subprocess.CalledProcessError: If `curl`, `tar`, or `chmod` fails.
9797 """
9898 downloaded_dataset = DownloadedDataset (
99- name = name ,
99+ dataset_name = dataset_name ,
100100 tarball_url = tarball_url ,
101101 integration_test_path_config = integration_test_path_config ,
102102 )
103- if request .config .cache .get (name , False ):
104- logger .info ("Test logs `%s` are up-to-date. Skipping download." , name )
103+ if request .config .cache .get (dataset_name , False ):
104+ logger .info ("Test logs `%s` are up-to-date. Skipping download." , dataset_name )
105105 return downloaded_dataset
106106
107107 remove_path (downloaded_dataset .tarball_path )
@@ -142,6 +142,6 @@ def _download_and_extract_gzip_dataset(
142142 subprocess .run ([chmod_bin , "gu+w" , tarball_path_str ], check = True )
143143 subprocess .run ([chmod_bin , "-R" , "gu+w" , extract_path_str ], check = True )
144144
145- logger .info ("Downloaded and extracted uncompressed logs for dataset `%s`." , name )
146- request .config .cache .set (name , True )
145+ logger .info ("Downloaded and extracted uncompressed logs for dataset `%s`." , dataset_name )
146+ request .config .cache .set (dataset_name , True )
147147 return downloaded_dataset
0 commit comments