Skip to content

Commit

Permalink
test notebooks: ensure all can be run under pycov
Browse files Browse the repository at this point in the history
  • Loading branch information
willfurnass committed Oct 1, 2019
1 parent 84bdd17 commit 383f413
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 51 deletions.
2 changes: 1 addition & 1 deletion TestNotebooks/MiscTests/MuMoTtest_1dstream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion TestNotebooks/MiscTests/MuMoTtest_3dstream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion TestNotebooks/MiscTests/MuMoTtest_GreekLetters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
63 changes: 30 additions & 33 deletions TestNotebooks/MiscTests/MuMoTtest_MasterEq.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Created `%%model` as an alias for `%%latex`.\n"
]
},
{
"data": {
"text/plain": [
"'1.0.0'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import mumot\n",
"\n",
Expand All @@ -20,15 +38,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"%%model\n",
"$\n",
"model1_str = (r\"\"\"\n",
"A -> B : k_1\n",
"B -> A : k_2\n",
"$"
"\"\"\")"
]
},
{
Expand All @@ -37,7 +54,7 @@
"metadata": {},
"outputs": [],
"source": [
"model1 = mumot.parseModel(In[2])"
"model1 = mumot.parseModel(model1_str)"
]
},
{
Expand Down Expand Up @@ -118,8 +135,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%model\n",
"$\n",
"model2 = mumot.parseModel(r\"\"\"\n",
"U -> A : g_1\n",
"U -> B : g_2\n",
"A -> U : a_1\n",
Expand All @@ -128,16 +144,7 @@
"B + U -> B + B : r_2\n",
"A + B -> A + U : s_1\n",
"A + B -> B + U : s_2\n",
"$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model2 = mumot.parseModel(In[12])"
"\"\"\")"
]
},
{
Expand Down Expand Up @@ -308,8 +315,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%model\n",
"$\n",
"model4 = mumot.parseModel(r\"\"\"\n",
"U -> A : g_1\n",
"U -> B : g_2\n",
"U -> C : g_3\n",
Expand All @@ -325,16 +331,7 @@
"A + C -> C + U : s_4\n",
"B + C -> B + U : s_5\n",
"B + C -> C + U : s_6\n",
"$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model4 = mumot.parseModel(In[44])"
"\"\"\")"
]
},
{
Expand Down Expand Up @@ -516,7 +513,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion TestNotebooks/MiscTests/MuMoTtest_MultiController.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 3 additions & 4 deletions TestNotebooks/MiscTests/MuMoTtest_bifurcation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%model\n",
"$\n",
"model1 = mumot.parseModel(r\"\"\"\n",
"U -> A : g_A\n",
"U -> B : g_B\n",
"A -> U : a_A\n",
Expand All @@ -34,7 +33,7 @@
"B + U -> B + B : r_B\n",
"A + B -> A + U : s\n",
"A + B -> B + U : s\n",
"$"
"\"\"\")"
]
},
{
Expand Down Expand Up @@ -151,7 +150,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion TestNotebooks/MuMoTtest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
21 changes: 12 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ whitelist_externals =
test
wc
make
xargs
find
commands =
; Ensure ipywidgets Jupyter extension is installed
jupyter nbextension enable --py --sys-prefix widgetsnbextension

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

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

; Ensure the user manual and regression test Notebooks do not show regressions (TODO; leave commented)
; Ensure test Notebooks run *without errors* (do not check for regressions yet)
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 \
--cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" TestNotebooks

; Ensure demo Notebooks run *without errors* (do not check for regressions yet)
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
pytest --verbose --maxfail=1 --nbval-lax --nbval-cell-timeout=120 DemoNotebooks

; Ensure the main regression test Notebook does not show regressions (TODO; leave commented)
; (add --nbdime if running tox locally and want to visualise/explore diffs in web browser)
; pytest --verbose --maxfail=1 --nbval --nbval-cell-timeout=120 --cov-config=tox.ini --cov="{envsitepackagesdir}/mumot" --cov-append TestNotebooks/MuMoTtest.ipynb

Expand Down

0 comments on commit 383f413

Please sign in to comment.