Skip to content

Commit

Permalink
Merge pull request #8 from mfschroeder/master
Browse files Browse the repository at this point in the history
Testing for core module elmer.py
  • Loading branch information
arvedes committed Sep 9, 2021
2 parents f9199ed + 4a6e33f commit f79176c
Show file tree
Hide file tree
Showing 13 changed files with 512 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Python Package using Conda

on: [push, pull_request]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda install pytest
pytest
- name: Code coverage with pytest
run: |
conda install pytest
conda install pytest-cov
pytest --cov=pyelmer/test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ examples/3D_Electrostatic_Capacitance/LaTeX_Source/main.run.xml
examples/3D_Electrostatic_Capacitance/LaTeX_Source/main.synctex.gz
*.toc
*.bbl
.coverage
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: test
channels:
- conda-forge
- defaults
dependencies:
- pyyaml
- python-gmsh
- matplotlib
- numpy
2 changes: 2 additions & 0 deletions pyelmer/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def plot_residuals(sim_dir, solvers, save=False):

residuals = {}
linres_str = {} # string to detect linear solver residuals
lin_res_idx = []
lin_res_relc = []
for solver in solvers:
residuals.update({solver: SolverResiduals([SteadyStateIteration([])])})
if solver == "heat equation":
Expand Down
2 changes: 2 additions & 0 deletions pyelmer/test/test_data/body_forces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test_body_force:
Test Parameter: "1.0"
3 changes: 3 additions & 0 deletions pyelmer/test/test_data/boundaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_boundary:
test_parameter: "1.0"

2 changes: 2 additions & 0 deletions pyelmer/test/test_data/initial_conditions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test_initial_condition:
test_parameter: "1.0"
2 changes: 2 additions & 0 deletions pyelmer/test/test_data/materials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test_material:
test_parameter: "1.0"
2 changes: 2 additions & 0 deletions pyelmer/test/test_data/simulations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test_simulation:
Test Parameter: "1.0"
5 changes: 5 additions & 0 deletions pyelmer/test/test_data/solvers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_solver:
test_parameter: "1.0"

test_post_solver:
test_post_parameter: "1.0"
Loading

0 comments on commit f79176c

Please sign in to comment.