From c7831ea09302cd606d79294a30bb639e8dcf42db Mon Sep 17 00:00:00 2001 From: nstarman Date: Fri, 15 Dec 2023 17:37:13 -0500 Subject: [PATCH 1/4] Start implementing smoke testing 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/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 8 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/smoke/__init__.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..693c86cb 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 . + - 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/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 From 83c098170693b5eea0e662ff495c718427b91baf Mon Sep 17 00:00:00 2001 From: nstarman Date: Fri, 15 Dec 2023 20:46:30 -0500 Subject: [PATCH 2/4] add more api tests Signed-off-by: nstarman --- tests/smoke/dynamics/__init__.py | 0 tests/smoke/dynamics/mockstream/__init__.py | 0 tests/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 ++++++++++ 6 files changed, 30 insertions(+) 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 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..5beca34d --- /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_version(): + """Test the API.""" + assert set(integrate.__all__) == set( + integrate._base.__all__ + integrate._builtin.__all__ + ) From f515d293738f6892a9ce26fb3d57773d278f2ccf Mon Sep 17 00:00:00 2001 From: nstarman Date: Fri, 15 Dec 2023 20:48:14 -0500 Subject: [PATCH 3/4] install test dependencies Signed-off-by: nstarman --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 693c86cb..7797aa89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: with: python-version: "3.x" - name: Install package - run: python -m pip install . + run: python -m pip install ".[test]" - name: Run smoke test run: python -m pytest tests/smoke -ra From 80b86564be179bea8d8875bbbbae9e2285e08f22 Mon Sep 17 00:00:00 2001 From: Nathaniel Starkman Date: Sat, 16 Dec 2023 14:43:34 -0500 Subject: [PATCH 4/4] Update tests/smoke/integrate/test_package.py --- tests/smoke/integrate/test_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/smoke/integrate/test_package.py b/tests/smoke/integrate/test_package.py index 5beca34d..6ab30014 100644 --- a/tests/smoke/integrate/test_package.py +++ b/tests/smoke/integrate/test_package.py @@ -3,7 +3,7 @@ from galax import integrate -def test_version(): +def test_all(): """Test the API.""" assert set(integrate.__all__) == set( integrate._base.__all__ + integrate._builtin.__all__