-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from avaldebe/CO-vs-Co
Co vs CO
- Loading branch information
Showing
4 changed files
with
147 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
from pathlib import Path | ||
|
||
from typer.testing import CliRunner | ||
import pytest | ||
from click.testing import CliRunner | ||
|
||
from airbase.cli import main | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_download(tmp_path: Path): | ||
country, year, pollutant, id = "NO", 2021, "NO2", 8 | ||
@pytest.mark.parametrize( | ||
"country,year,pollutant,id", | ||
( | ||
pytest.param("NO", 2021, "NO2", 8, id="NO2"), | ||
pytest.param("NO", 2021, "CO", 10, id="CO"), | ||
), | ||
) | ||
def test_download( | ||
country: str, year: int, pollutant: str, id: int, tmp_path: Path | ||
): | ||
options = f"download --quiet --country {country} --pollutant {pollutant} --year {year} --path {tmp_path}" | ||
result = runner.invoke(main, options.split()) | ||
assert result.exit_code == 0 | ||
with runner.isolated_filesystem(temp_dir=tmp_path): | ||
result = runner.invoke(main, options.split()) | ||
assert result.exit_code == 0 | ||
files = tmp_path.glob(f"{country}_{id}_*_{year}_timeseries.csv") | ||
|
||
files = tmp_path.glob(f"{country}_{id}_*_{year}_timeseries.csv") | ||
assert list(files) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters