diff --git a/pyproject.toml b/pyproject.toml index 90f83192..e5ba263b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,8 @@ sphinx = "^7.2.6" sphinx-click = "^5.1.0" numpydoc = "^1.6.0" +[tool.poetry.scripts] +nomenclature = 'nomenclature.cli:cli' [tool.poetry-dynamic-versioning] bump = true diff --git a/tests/test_cli.py b/tests/test_cli.py index c20bc818..9d0f4753 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,6 @@ +import subprocess +import sys + from click.testing import CliRunner from nomenclature import cli from nomenclature.testing import assert_valid_yaml, assert_valid_structure @@ -9,6 +12,29 @@ runner = CliRunner() +@pytest.mark.xfail( + sys.platform.startswith("win"), + reason="Command to invoke the cli does not work on Windows", +) +def test_cli_installed(): + command = "poetry run nomenclature" + result = subprocess.run( + command, + capture_output=True, + text=True, + shell=True, + check=True, + ) + assert all( + command in result.stdout + for command in ( + "check-region-aggregation", + "validate-project", + "validate-yaml", + ) + ) + + def test_cli_valid_yaml_path(): """Check that CLI throws an error when the `path` is incorrect""" result_valid = runner.invoke(