From 1eca3aede4624cd2767fb1d7c6266cb15376c9e3 Mon Sep 17 00:00:00 2001 From: Nathaniel Starkman Date: Sat, 20 Jan 2024 13:45:49 -0500 Subject: [PATCH] Start implementing smoke testing (#40) * Start implementing smoke testing * add more api tests * install test dependencies Where there's smoke, there's fire! See https://www.atlassian.com/continuous-delivery/software-testing/types-of-software-testing Signed-off-by: nstarman --- .github/workflows/ci.yml | 18 +++++++++++++++++- pyproject.toml | 4 +++- tests/smoke/__init__.py | 0 tests/smoke/dynamics/__init__.py | 0 tests/smoke/dynamics/mockstream/__init__.py | 0 .../smoke/dynamics/mockstream/test_package.py | 10 ++++++++++ tests/smoke/dynamics/test_package.py | 10 ++++++++++ tests/smoke/integrate/__init__.py | 0 tests/smoke/integrate/test_package.py | 10 ++++++++++ tests/smoke/potential/__init__.py | 0 .../{unit => smoke}/potential/test_package.py | 0 tests/{unit => smoke}/test_package.py | 0 tests/smoke/utils/__init__.py | 0 tests/{unit => smoke}/utils/test_package.py | 0 14 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tests/smoke/__init__.py create mode 100644 tests/smoke/dynamics/__init__.py create mode 100644 tests/smoke/dynamics/mockstream/__init__.py create mode 100644 tests/smoke/dynamics/mockstream/test_package.py create mode 100644 tests/smoke/dynamics/test_package.py create mode 100644 tests/smoke/integrate/__init__.py create mode 100644 tests/smoke/integrate/test_package.py create mode 100644 tests/smoke/potential/__init__.py rename tests/{unit => smoke}/potential/test_package.py (100%) rename tests/{unit => smoke}/test_package.py (100%) create mode 100644 tests/smoke/utils/__init__.py rename tests/{unit => smoke}/utils/test_package.py (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e224df24..7797aa89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,10 +33,26 @@ jobs: # echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" # pipx run nox -s pylint + # Where there's smoke, there's fire! + smoke: + name: Smoke tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install package + run: python -m pip install ".[test]" + - name: Run smoke test + run: python -m pytest tests/smoke -ra + checks: name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }} - needs: [pre-commit] + needs: [pre-commit, smoke] strategy: fail-fast: false matrix: diff --git a/pyproject.toml b/pyproject.toml index da74317a..4f847ae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,9 @@ filterwarnings = [ ] log_cli_level = "INFO" testpaths = [ - "tests", + "tests/", + "docs", + "src/galax", ] diff --git a/tests/smoke/__init__.py b/tests/smoke/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/smoke/dynamics/__init__.py b/tests/smoke/dynamics/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/smoke/dynamics/mockstream/__init__.py b/tests/smoke/dynamics/mockstream/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/smoke/dynamics/mockstream/test_package.py b/tests/smoke/dynamics/mockstream/test_package.py new file mode 100644 index 00000000..cc14e3a3 --- /dev/null +++ b/tests/smoke/dynamics/mockstream/test_package.py @@ -0,0 +1,10 @@ +"""Testing :mod:`galax.dynamics.mockstream` module.""" + +from galax.dynamics import mockstream + + +def test_all(): + """Test the `galax.dynamics.mockstream` API.""" + assert set(mockstream.__all__) == set( + mockstream._df.__all__ + mockstream._mockstream_generator.__all__ + ) diff --git a/tests/smoke/dynamics/test_package.py b/tests/smoke/dynamics/test_package.py new file mode 100644 index 00000000..f4f8e587 --- /dev/null +++ b/tests/smoke/dynamics/test_package.py @@ -0,0 +1,10 @@ +"""Testing :mod:`galax.dynamics` module.""" + +import galax.dynamics as gd + + +def test_all(): + """Test the `galax.potential` API.""" + assert set(gd.__all__) == set( + gd._core.__all__ + gd._orbit.__all__ + gd.mockstream.__all__ + ) diff --git a/tests/smoke/integrate/__init__.py b/tests/smoke/integrate/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/smoke/integrate/test_package.py b/tests/smoke/integrate/test_package.py new file mode 100644 index 00000000..6ab30014 --- /dev/null +++ b/tests/smoke/integrate/test_package.py @@ -0,0 +1,10 @@ +"""Test the :mod:`galax.integrate` module.""" + +from galax import integrate + + +def test_all(): + """Test the API.""" + assert set(integrate.__all__) == set( + integrate._base.__all__ + integrate._builtin.__all__ + ) diff --git a/tests/smoke/potential/__init__.py b/tests/smoke/potential/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/potential/test_package.py b/tests/smoke/potential/test_package.py similarity index 100% rename from tests/unit/potential/test_package.py rename to tests/smoke/potential/test_package.py diff --git a/tests/unit/test_package.py b/tests/smoke/test_package.py similarity index 100% rename from tests/unit/test_package.py rename to tests/smoke/test_package.py diff --git a/tests/smoke/utils/__init__.py b/tests/smoke/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/utils/test_package.py b/tests/smoke/utils/test_package.py similarity index 100% rename from tests/unit/utils/test_package.py rename to tests/smoke/utils/test_package.py