Skip to content

Commit 383f413

Browse files
committed
test notebooks: ensure all can be run under pycov
1 parent 84bdd17 commit 383f413

8 files changed

Lines changed: 50 additions & 51 deletions

TestNotebooks/MiscTests/MuMoTtest_1dstream.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"name": "python",
7676
"nbconvert_exporter": "python",
7777
"pygments_lexer": "ipython3",
78-
"version": "3.6.8"
78+
"version": "3.7.4"
7979
},
8080
"toc": {
8181
"base_numbering": 1,

TestNotebooks/MiscTests/MuMoTtest_3dstream.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"name": "python",
132132
"nbconvert_exporter": "python",
133133
"pygments_lexer": "ipython3",
134-
"version": "3.6.8"
134+
"version": "3.7.4"
135135
},
136136
"toc": {
137137
"base_numbering": 1,

TestNotebooks/MiscTests/MuMoTtest_GreekLetters.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"name": "python",
198198
"nbconvert_exporter": "python",
199199
"pygments_lexer": "ipython3",
200-
"version": "3.5.4"
200+
"version": "3.7.4"
201201
},
202202
"toc": {
203203
"base_numbering": 1,

TestNotebooks/MiscTests/MuMoTtest_MasterEq.ipynb

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,27 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": null,
13-
"metadata": {},
14-
"outputs": [],
12+
"execution_count": 1,
13+
"metadata": {},
14+
"outputs": [
15+
{
16+
"name": "stdout",
17+
"output_type": "stream",
18+
"text": [
19+
"Created `%%model` as an alias for `%%latex`.\n"
20+
]
21+
},
22+
{
23+
"data": {
24+
"text/plain": [
25+
"'1.0.0'"
26+
]
27+
},
28+
"execution_count": 1,
29+
"metadata": {},
30+
"output_type": "execute_result"
31+
}
32+
],
1533
"source": [
1634
"import mumot\n",
1735
"\n",
@@ -20,15 +38,14 @@
2038
},
2139
{
2240
"cell_type": "code",
23-
"execution_count": null,
41+
"execution_count": 3,
2442
"metadata": {},
2543
"outputs": [],
2644
"source": [
27-
"%%model\n",
28-
"$\n",
45+
"model1_str = (r\"\"\"\n",
2946
"A -> B : k_1\n",
3047
"B -> A : k_2\n",
31-
"$"
48+
"\"\"\")"
3249
]
3350
},
3451
{
@@ -37,7 +54,7 @@
3754
"metadata": {},
3855
"outputs": [],
3956
"source": [
40-
"model1 = mumot.parseModel(In[2])"
57+
"model1 = mumot.parseModel(model1_str)"
4158
]
4259
},
4360
{
@@ -118,8 +135,7 @@
118135
"metadata": {},
119136
"outputs": [],
120137
"source": [
121-
"%%model\n",
122-
"$\n",
138+
"model2 = mumot.parseModel(r\"\"\"\n",
123139
"U -> A : g_1\n",
124140
"U -> B : g_2\n",
125141
"A -> U : a_1\n",
@@ -128,16 +144,7 @@
128144
"B + U -> B + B : r_2\n",
129145
"A + B -> A + U : s_1\n",
130146
"A + B -> B + U : s_2\n",
131-
"$"
132-
]
133-
},
134-
{
135-
"cell_type": "code",
136-
"execution_count": null,
137-
"metadata": {},
138-
"outputs": [],
139-
"source": [
140-
"model2 = mumot.parseModel(In[12])"
147+
"\"\"\")"
141148
]
142149
},
143150
{
@@ -308,8 +315,7 @@
308315
"metadata": {},
309316
"outputs": [],
310317
"source": [
311-
"%%model\n",
312-
"$\n",
318+
"model4 = mumot.parseModel(r\"\"\"\n",
313319
"U -> A : g_1\n",
314320
"U -> B : g_2\n",
315321
"U -> C : g_3\n",
@@ -325,16 +331,7 @@
325331
"A + C -> C + U : s_4\n",
326332
"B + C -> B + U : s_5\n",
327333
"B + C -> C + U : s_6\n",
328-
"$"
329-
]
330-
},
331-
{
332-
"cell_type": "code",
333-
"execution_count": null,
334-
"metadata": {},
335-
"outputs": [],
336-
"source": [
337-
"model4 = mumot.parseModel(In[44])"
334+
"\"\"\")"
338335
]
339336
},
340337
{
@@ -516,7 +513,7 @@
516513
"name": "python",
517514
"nbconvert_exporter": "python",
518515
"pygments_lexer": "ipython3",
519-
"version": "3.5.4"
516+
"version": "3.7.4"
520517
},
521518
"toc": {
522519
"base_numbering": 1,

TestNotebooks/MiscTests/MuMoTtest_MultiController.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
"name": "python",
263263
"nbconvert_exporter": "python",
264264
"pygments_lexer": "ipython3",
265-
"version": "3.6.8"
265+
"version": "3.7.4"
266266
},
267267
"toc": {
268268
"base_numbering": 1,

TestNotebooks/MiscTests/MuMoTtest_bifurcation.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"metadata": {},
2525
"outputs": [],
2626
"source": [
27-
"%%model\n",
28-
"$\n",
27+
"model1 = mumot.parseModel(r\"\"\"\n",
2928
"U -> A : g_A\n",
3029
"U -> B : g_B\n",
3130
"A -> U : a_A\n",
@@ -34,7 +33,7 @@
3433
"B + U -> B + B : r_B\n",
3534
"A + B -> A + U : s\n",
3635
"A + B -> B + U : s\n",
37-
"$"
36+
"\"\"\")"
3837
]
3938
},
4039
{
@@ -151,7 +150,7 @@
151150
"name": "python",
152151
"nbconvert_exporter": "python",
153152
"pygments_lexer": "ipython3",
154-
"version": "3.5.4"
153+
"version": "3.7.4"
155154
},
156155
"toc": {
157156
"base_numbering": 1,

TestNotebooks/MuMoTtest.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@
10441044
"name": "python",
10451045
"nbconvert_exporter": "python",
10461046
"pygments_lexer": "ipython3",
1047-
"version": "3.6.8"
1047+
"version": "3.7.4"
10481048
},
10491049
"toc": {
10501050
"base_numbering": 1,

tox.ini

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,27 @@ whitelist_externals =
1212
test
1313
wc
1414
make
15-
xargs
16-
find
1715
commands =
1816
; Ensure ipywidgets Jupyter extension is installed
1917
jupyter nbextension enable --py --sys-prefix widgetsnbextension
2018

2119
; Run unit tests and generate code coverage report
2220
pytest --verbose --cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" tests
2321

24-
; Ensure user manual, test and demo Notebooks run *without errors* (do not check for regressions yet)
22+
; Ensure the user manual Notebook runs *without errors* (do not check for regressions yet)
2523
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
26-
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 --cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" --cov-append \
27-
docs/*.ipynb \
28-
TestNotebooks/*.ipynb \
29-
TestNotebooks/MiscTests/*.ipynb \
30-
DemoNotebooks/*
24+
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 docs/MuMoTuserManual.ipynb
3125

32-
; Ensure the user manual and regression test Notebooks do not show regressions (TODO; leave commented)
26+
; Ensure test Notebooks run *without errors* (do not check for regressions yet)
27+
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
28+
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 \
29+
--cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" TestNotebooks
30+
31+
; Ensure demo Notebooks run *without errors* (do not check for regressions yet)
32+
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
33+
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 DemoNotebooks
34+
35+
; Ensure the main regression test Notebook does not show regressions (TODO; leave commented)
3336
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
3437
; pytest --verbose --maxfail=1 --nbval --nbval-cell-timeout=120 --cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" --cov-append TestNotebooks/MuMoTtest.ipynb
3538

0 commit comments

Comments
 (0)