From 0cd93bf9600526c2c3fe1cb93955bdcba652c421 Mon Sep 17 00:00:00 2001 From: Tianlu Yuan <5412915+tianluyuan@users.noreply.github.com> Date: Tue, 12 Nov 2024 00:17:03 -0600 Subject: [PATCH] Include tests as part of package (#28) * move tests into package * Run pytest CI on specified paths. Update README * update pytest.yml --- .github/workflows/pytest.yml | 8 +++++++- README.md | 9 ++++++++- {tests => nuVeto/tests}/test_app.py | 0 3 files changed, 15 insertions(+), 2 deletions(-) rename {tests => nuVeto/tests}/test_app.py (100%) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8454e6e..b6da44f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -5,8 +5,14 @@ name: status on: push: branches: [ main ] + paths: + - '**/*.py' + - '.github/workflows/*' pull_request: branches: [ main ] + paths: + - '**/*.py' + - '.github/workflows/*' schedule: # * is a special character in YAML so you have to quote this string - cron: '25 9 * * 2' @@ -28,8 +34,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install flake8 pip install -e .[testing] - name: Lint with flake8 run: | diff --git a/README.md b/README.md index 1d0a984..b2bdf02 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,14 @@ pip install nuVeto This will install [MCEq](https://github.com/afedynitch/MCEq). -Extras are `pip install nuVeto[plotting, resources]` which will install some packages for plotting and generating muon reaching probabilities. +Since v2.3.1, a suite of tests is also installed with an optional dependency on `pytest`. The follow command should test if the installation worked as expected. + +```bash +pip install nuVeto[testing] +pytest --pyargs nuVeto +``` + +Extras are `pip install nuVeto[plotting, resources]` which will install some packages for making example plots and generating muon reaching probabilities. ### Usage diff --git a/tests/test_app.py b/nuVeto/tests/test_app.py similarity index 100% rename from tests/test_app.py rename to nuVeto/tests/test_app.py