1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import os
- import subprocess
- from pathlib import Path
- def test_read_data_set(tmp_path):
- script_path = Path(__file__).parent.parent.parent / "scripts" / "read_data_set.py"
-
- command = [
- "poetry",
- "run",
- "python3",
- str(script_path),
- "--save_path",
- str(tmp_path),
- "--run_id",
- "2024",
- ]
-
- result = subprocess.run(command, capture_output=True, text=True, check=False)
-
- assert result.returncode == 0, f"Script failed: {result.stderr}"
- release_folder = os.listdir(tmp_path)
-
- assert len(release_folder) == 1
-
- assert release_folder[0].startswith("v")
- output_files = os.listdir(tmp_path / release_folder[0])
-
- assert len(output_files) == 3
-
- required_extensions = {"nc", "csv", "yaml"}
- file_extensions = {file.split(".")[-1] for file in output_files}
- assert required_extensions == file_extensions
|