tests.workflow_aws_download_test

 1import pytest
 2
 3import config.config
 4from main import workflow_aws_download
 5from utils.logging import configure_logging
 6
 7
 8@pytest.fixture(autouse=True)
 9def deactivate_hf_sync():
10    config.config.HF_DO_UPLOAD = False
11
12
13@pytest.fixture(autouse=True)
14def setup_logging():
15    configure_logging()
16
17
18@pytest.mark.parametrize("selected_dataset_overwrite", [True, False])
19def test_aws_download(selected_dataset_overwrite):
20    """Tests AWS download functionality by verifying dataset and file count with given configuration."""
21
22    config = {
23        "bucket": "mcity-data-engine",
24        "prefix": "",
25        "download_path": "output/datasets/annarbor_rolling",
26        "test_run": True,
27        "selected_dataset_overwrite": selected_dataset_overwrite,
28    }
29
30    dataset, dataset_name, files_to_be_downloaded = workflow_aws_download(
31        config, wandb_activate=False
32    )
33
34    if len(dataset) == 0 and config["test_run"] == True:
35        assert files_to_be_downloaded != 0, "No files found in AWS bucket"
36    else:
37        assert len(dataset) != 0, "Dataset has no samples"
@pytest.fixture(autouse=True)
def deactivate_hf_sync():
 9@pytest.fixture(autouse=True)
10def deactivate_hf_sync():
11    config.config.HF_DO_UPLOAD = False
@pytest.fixture(autouse=True)
def setup_logging():
14@pytest.fixture(autouse=True)
15def setup_logging():
16    configure_logging()
@pytest.mark.parametrize('selected_dataset_overwrite', [True, False])
def test_aws_download(selected_dataset_overwrite):
19@pytest.mark.parametrize("selected_dataset_overwrite", [True, False])
20def test_aws_download(selected_dataset_overwrite):
21    """Tests AWS download functionality by verifying dataset and file count with given configuration."""
22
23    config = {
24        "bucket": "mcity-data-engine",
25        "prefix": "",
26        "download_path": "output/datasets/annarbor_rolling",
27        "test_run": True,
28        "selected_dataset_overwrite": selected_dataset_overwrite,
29    }
30
31    dataset, dataset_name, files_to_be_downloaded = workflow_aws_download(
32        config, wandb_activate=False
33    )
34
35    if len(dataset) == 0 and config["test_run"] == True:
36        assert files_to_be_downloaded != 0, "No files found in AWS bucket"
37    else:
38        assert len(dataset) != 0, "Dataset has no samples"

Tests AWS download functionality by verifying dataset and file count with given configuration.