Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Apr 23, 2024
1 parent f992d5e commit 4a2348b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
3 changes: 0 additions & 3 deletions build/cli_wrapper/.vscode/settings.json

This file was deleted.

22 changes: 20 additions & 2 deletions build/tests/test_models.py → build/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,38 @@
import ribasim
import ribasim_testmodels

executable = Path(__file__).parents[1] / "ribasim" / "ribasim"


@pytest.mark.parametrize(
"model_constructor",
ribasim_testmodels.constructors.values(),
)
def test_ribasim_cli(model_constructor, tmp_path):
def test_models(model_constructor, tmp_path):
model = model_constructor()
assert isinstance(model, ribasim.Model)
model.write(tmp_path / "ribasim.toml")

executable = Path(__file__).parents[1] / "ribasim" / "ribasim"
result = subprocess.run([executable, tmp_path / "ribasim.toml"])

if model_constructor.__name__.startswith("invalid_"):
assert result.returncode != 0
else:
assert result.returncode == 0


def test_version():
result = subprocess.run(
[executable, "--version"], check=True, capture_output=True, text=True
)

assert ribasim.__version__ in result.stdout


def test_help():
subprocess.run([executable, "--help"], check=True)


def test_missing_toml():
result = subprocess.run([executable, "/there/is/no/toml"])
assert result.returncode != 0

0 comments on commit 4a2348b

Please sign in to comment.