Skip to content

Commit

Permalink
Test the first five tutorials on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-ballarin committed Dec 30, 2023
1 parent e1eaa4f commit d05c2e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ jobs:
- name: Run unit tests
run: pytest -svv tests/unit
- name: Run performance tests
run: pytest --benchmark-disable tests/performance
run: pytest --benchmark-disable -svv tests/performance
- name: Run tutorials
run: |
cd tutorials/01_thermal_block && pytest -svv tutorial_thermal_block.ipynb && cd -
cd tutorials/02_elastic_block && pytest -svv tutorial_elastic_block.ipynb && cd -
cd tutorials/03_hole && pytest -svv tutorial_hole.ipynb && cd -
cd tutorials/04_graetz && pytest -svv tutorial_graetz_1.ipynb && cd -
cd tutorials/05_gaussian && pytest -svv tutorial_gaussian_eim.ipynb && cd -
docker:
if: github.repository == 'RBniCS/RBniCS' && github.ref == 'refs/heads/master'
Expand Down
4 changes: 2 additions & 2 deletions tutorials/04_graetz/tutorial_graetz_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
"source": [
"lifting_mu = (1.0, 1.0)\n",
"problem.set_mu(lifting_mu)\n",
"reduction_method.initialize_training_set(200, SCM=250)\n",
"reduction_method.initialize_training_set(100, SCM=50)\n",
"reduced_problem = reduction_method.offline()"
]
},
Expand Down Expand Up @@ -296,7 +296,7 @@
"metadata": {},
"outputs": [],
"source": [
"reduction_method.initialize_testing_set(100, SCM=100)\n",
"reduction_method.initialize_testing_set(100, SCM=50)\n",
"reduction_method.error_analysis(filename=\"error_analysis\")"
]
},
Expand Down
14 changes: 5 additions & 9 deletions tutorials/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sys
import importlib
import pytest
import pytest_flake8
from nbconvert.exporters import PythonExporter
import nbconvert.filters
from mpi4py import MPI
Expand Down Expand Up @@ -67,14 +66,11 @@ def ipython2python(code):
MPI.COMM_WORLD.Barrier()
# Collect the corresponding .py file
config = parent.config
if config.getoption("--flake8"):
return pytest_flake8.pytest_collect_file(file_path.with_suffix(".py"), None, parent)
else:
if "data" not in str(file_path.parent): # skip running mesh generation notebooks
if not file_path.name.startswith("x"):
return TutorialFile.from_parent(parent=parent, path=file_path.with_suffix(".py"))
else:
return DoNothingFile.from_parent(parent=parent, path=file_path.with_suffix(".py"))
if "data" not in str(file_path.parent): # skip running mesh generation notebooks
if not file_path.name.startswith("x"):
return TutorialFile.from_parent(parent=parent, path=file_path.with_suffix(".py"))
else:
return DoNothingFile.from_parent(parent=parent, path=file_path.with_suffix(".py"))
elif file_path.suffix == ".py": # TODO remove after transition to ipynb is complete? assert never py files?
if (file_path.name not in "conftest.py" # do not run pytest configuration file
or "data" not in str(file_path.parent)): # skip running mesh generation notebooks
Expand Down

0 comments on commit d05c2e3

Please sign in to comment.