From 6cbcea74be7819efc1f5b9d95776b56780cf2086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Alonso=20=C3=81lvarez?= Date: Wed, 15 Nov 2023 07:59:28 +0000 Subject: [PATCH] Facilitate wsimod to run with -m --- .github/workflows/ci.yml | 4 +--- tests/test_example_files.py | 2 +- wsimod/__main__.py | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7b71cf..2666f5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install and build - run: | - python -m pip install -r requirements-dev.txt - python -m pip install . + run: python -m pip install -r requirements-dev.txt - name: Run tests run: python -m pytest diff --git a/tests/test_example_files.py b/tests/test_example_files.py index 752e225..f29c65b 100644 --- a/tests/test_example_files.py +++ b/tests/test_example_files.py @@ -11,7 +11,7 @@ def collect_examples() -> list[Path]: @mark.parametrize("example", collect_examples()) def test_examples(example: Path, tmp_path: Path) -> None: result = subprocess.run( - ["wsimod", str(example), "-o", str(tmp_path)], + ["python", "-m", "wsimod", str(example), "-o", str(tmp_path)], shell=True, check=True, ) diff --git a/wsimod/__main__.py b/wsimod/__main__.py index 6655783..8cc990e 100644 --- a/wsimod/__main__.py +++ b/wsimod/__main__.py @@ -66,3 +66,7 @@ def run() -> None: loaded_settings = assign_data_to_settings(settings, loaded_data) run_model(loaded_settings, outputs) + + +if __name__ == "__main__": + run()