Skip to content

Commit 453b9aa

Browse files
committed
[tests] simplify demo test by using pytest-regressions
1 parent 4616a48 commit 453b9aa

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

.ci/requirements-ci.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ pytest
22
wheel
33
build
44
pytest
5-
pytest-regressions
5+
pytest-regressions
6+
pandas

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ Development notes
2121
We have a `pre-commit` config that is also run/checked in CI.
2222
Python source is formatted with `black`.
2323
C++ source is formatted with `clang-format`.
24+
25+
Dependencies for running the test suite can be installed with
26+
27+
```
28+
python -m pip install -r ./.ci/requirements-ci.txt
29+
```

test/demo_result.pickle

-6.04 KB
Binary file not shown.

test/test_demo.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
import pickle
2-
from pathlib import Path
3-
import numpy as np
4-
5-
6-
def test_demo_results():
7-
fn = Path(__file__).resolve().parent / "demo_result.pickle"
8-
good_result = pickle.load(open(str(fn), "rb"))
9-
1+
def test_demo_results(ndarrays_regression):
102
from pymor_dealii.pymor.demo import run
113

124
result, _, _, _ = run(plot_error=False)
13-
pickle.dump(
14-
result,
15-
open(Path(__file__).resolve().parent / "actual_demo_result.pickle", "wb"),
16-
)
175

186
compare = ["errors", "basis_sizes", "rel_errors"]
19-
for key in compare:
20-
assert np.allclose(result[key], good_result[key])
7+
ndarrays_regression.check({k: v for k, v in result.items() if k in compare})
1.52 KB
Binary file not shown.

0 commit comments

Comments
 (0)