Coverage for src/rechunk_data/tests/test_cli.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-30 09:58 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-30 09:58 +0000
1"""Unit tests for the cli."""
3from pathlib import Path
4from tempfile import TemporaryDirectory
6import pytest
7from rechunk_data import cli
10def test_command_line_interface(data_dir: Path) -> None:
11 """Test the cli method."""
12 with pytest.raises(SystemExit):
13 cli(["--help"])
15 with pytest.raises(SystemExit):
16 cli([str(data_dir), "--engine", "foo"])
18 data_files = sorted(data_dir.rglob("*.nc"))
19 with TemporaryDirectory() as temp_dir:
20 cli([str(data_dir), "--output", temp_dir])
21 new_files = sorted(Path(temp_dir).rglob("*.nc"))
22 assert len(data_files) == len(new_files)