Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional changes to Pytest-based tests and CI workflow #724

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test PyClaw

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

workflow_dispatch:

permissions:
contents: read

env:
CLAW: ${{ github.workspace }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran

python -m pip install --upgrade pip
pip install 'numpy<2.0'
pip install matplotlib #Some imports require matplotlib
pip install scipy #To not skip tests
pip install flake8 meson-python ninja pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Checkout Clawpack
uses: actions/[email protected]
with:
repository: clawpack/clawpack
submodules: true

- name: Checkout PyClaw branch
uses: actions/[email protected]
with:
path: pyclaw

- name: Install clawpack
run: |
cd ${CLAW}
pip install --no-build-isolation --editable .

- name: Test with pytest
run: |
cd ${CLAW}/pyclaw
pytest --ignore=development
5 changes: 1 addition & 4 deletions examples/euler_gravity_3d/test_eulerg3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ class TestEulerGravity3D:

def test_rising_hot_sphere(self):
_ = importorskip("scipy") # skip test if scipy is not installed
#Compile source
command = ["make", "all"]
subprocess.call(command,cwd=thisdir)

# Read expected solution
expected_density = np.loadtxt(os.path.join(thisdir,'verify_rising_hot_sphere_classic_1.txt'))

#Run test
import rising_hot_sphere
from . import rising_hot_sphere
claw = rising_hot_sphere.euler3d(kernel_language='Fortran',solver_type='classic',
disable_output=True,mx=80, my=80, mz=80, tfinal=1.0, num_output_times=1)
claw.run()
Expand Down
2 changes: 1 addition & 1 deletion examples/shallow_2d/test_shallow2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_radialdambreak(self):
for riemann_solver in riemann_solvers:
test_name = f'radialdambreak_{solver_type}_{riemann_solver}'
assert error(test_name=test_name, solver_type=solver_type,
riemann_solver=riemann_solver, disable_output=True)<1e-6, f"Test {test_name} failed"
riemann_solver=riemann_solver, disable_output=True)<1e-5, f"Test {test_name} failed"

def test_sill(self):
assert error(test_name="sill", outdir=None)<1e-6, f"Test sill failed"
Expand Down
Loading