|
1 | 1 | """Test cases for the __main__ module.""" |
2 | 2 |
|
| 3 | +import os |
3 | 4 | from pathlib import Path |
4 | 5 |
|
5 | 6 | import pytest |
|
8 | 9 | from mdio import __main__ |
9 | 10 |
|
10 | 11 |
|
11 | | -@pytest.fixture() |
| 12 | +@pytest.fixture |
12 | 13 | def runner() -> CliRunner: |
13 | 14 | """Fixture for invoking command-line interfaces.""" |
14 | 15 | return CliRunner() |
15 | 16 |
|
16 | 17 |
|
17 | | -@pytest.mark.dependency() |
| 18 | +@pytest.mark.dependency |
18 | 19 | def test_main_succeeds(runner: CliRunner, segy_input: str, zarr_tmp: Path) -> None: |
19 | 20 | """It exits with a status code of zero.""" |
20 | 21 | cli_args = ["segy", "import", segy_input, str(zarr_tmp)] |
21 | | - cli_args.extend(["-loc", "181,185"]) |
22 | | - cli_args.extend(["-names", "inline,crossline"]) |
| 22 | + cli_args.extend(["--header-locations", "181,185"]) |
| 23 | + cli_args.extend(["--header-names", "inline,crossline"]) |
| 24 | + |
| 25 | + result = runner.invoke(__main__.main, args=cli_args) |
| 26 | + assert result.exit_code == 0 |
| 27 | + |
| 28 | + |
| 29 | +@pytest.mark.dependency(depends=["test_main_succeeds"]) |
| 30 | +def test_main_cloud(runner: CliRunner, segy_input_uri: str, zarr_tmp: Path) -> None: |
| 31 | + """It exits with a status code of zero.""" |
| 32 | + os.environ["MDIO__IMPORT__CLOUD_NATIVE"] = "true" |
| 33 | + cli_args = ["segy", "import", str(segy_input_uri), str(zarr_tmp)] |
| 34 | + cli_args.extend(["--header-locations", "181,185"]) |
| 35 | + cli_args.extend(["--header-names", "inline,crossline"]) |
| 36 | + cli_args.extend(["--overwrite"]) |
23 | 37 |
|
24 | 38 | result = runner.invoke(__main__.main, args=cli_args) |
25 | 39 | assert result.exit_code == 0 |
|
0 commit comments