Skip to content

Commit 17c5be2

Browse files
authored
Merge pull request #162 from djarecka/fix/fixing_tests
[CI] fixing tests
2 parents 3633d35 + e0c7152 commit 17c5be2

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

.github/workflows/testing.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# In this step, this action saves a list of existing images,
1919
# the cache is created without them in the post run.
2020
# It also restores the cache if it exists.
21-
- uses: satackey/action-docker-layer-caching@v0.0.5
21+
- uses: satackey/action-docker-layer-caching@v0.0.7
2222
- name: build the image
2323
run: docker build . --file Dockerfile -t nipype_tutorial:latest
2424

@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v2
30-
- uses: satackey/action-docker-layer-caching@v0.0.5
30+
- uses: satackey/action-docker-layer-caching@v0.0.7
3131
- name: run test 1
3232
run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 1
3333

@@ -36,7 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v2
39-
- uses: satackey/action-docker-layer-caching@v0.0.5
39+
- uses: satackey/action-docker-layer-caching@v0.0.7
4040
- name: run test 2
4141
run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 2
4242

@@ -45,6 +45,6 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- uses: actions/checkout@v2
48-
- uses: satackey/action-docker-layer-caching@v0.0.5
48+
- uses: satackey/action-docker-layer-caching@v0.0.7
4949
- name: run test 3
5050
run: docker run --rm nipype_tutorial:latest python /home/neuro/nipype_tutorial/test_notebooks.py 3

notebooks/advanced_create_interfaces.ipynb

+14-7
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@
12141214
"from scipy.io import savemat\n",
12151215
"\n",
12161216
"# 1. save the image in matlab format as tmp_image.mat\n",
1217-
"tmp_image = 'tmp_image'\n",
1217+
"tmp_image = 'tmp_image.mat'\n",
12181218
"data = nb.load(in_file).get_data()\n",
12191219
"savemat(tmp_image, {b'data': data}, do_compression=False)"
12201220
]
@@ -1298,7 +1298,7 @@
12981298
"\n",
12991299
" def _run_interface(self, runtime): \n",
13001300
" # Save the image in matlab format as tmp_image.mat\n",
1301-
" tmp_image = 'tmp_image'\n",
1301+
" tmp_image = 'tmp_image.mat'\n",
13021302
" data = nb.load(self.inputs.in_file).get_data()\n",
13031303
" savemat(tmp_image, {b'data': data}, do_compression=False)\n",
13041304
" \n",
@@ -1374,7 +1374,7 @@
13741374
"cell_type": "code",
13751375
"execution_count": null,
13761376
"metadata": {
1377-
"solution2": "hidden",
1377+
"solution2": "shown",
13781378
"solution2_first": true
13791379
},
13801380
"outputs": [],
@@ -1386,7 +1386,7 @@
13861386
"cell_type": "code",
13871387
"execution_count": null,
13881388
"metadata": {
1389-
"solution2": "hidden"
1389+
"solution2": "shown"
13901390
},
13911391
"outputs": [],
13921392
"source": [
@@ -1411,7 +1411,7 @@
14111411
"\n",
14121412
" def _run_interface(self, runtime): \n",
14131413
" # Save the image in matlab format as tmp_image.mat\n",
1414-
" tmp_image = 'tmp_image'\n",
1414+
" tmp_image = 'tmp_image.mat'\n",
14151415
" data = nb.load(self.inputs.in_file).get_data()\n",
14161416
" savemat(tmp_image, {b'data': data}, do_compression=False)\n",
14171417
" \n",
@@ -1495,11 +1495,18 @@
14951495
"source": [
14961496
"!cat volume.txt"
14971497
]
1498+
},
1499+
{
1500+
"cell_type": "code",
1501+
"execution_count": null,
1502+
"metadata": {},
1503+
"outputs": [],
1504+
"source": []
14981505
}
14991506
],
15001507
"metadata": {
15011508
"kernelspec": {
1502-
"display_name": "Python [default]",
1509+
"display_name": "Python 3",
15031510
"language": "python",
15041511
"name": "python3"
15051512
},
@@ -1513,7 +1520,7 @@
15131520
"name": "python",
15141521
"nbconvert_exporter": "python",
15151522
"pygments_lexer": "ipython3",
1516-
"version": "3.6.5"
1523+
"version": "3.7.8"
15171524
}
15181525
},
15191526
"nbformat": 4,

notebooks/handson_analysis.ipynb

+10-4
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,11 @@
998998
"outputs": [],
999999
"source": [
10001000
"plot_glass_brain('/output/datasink_handson/normalized/sub-07/wess_0008.nii',\n",
1001+
" output_file=\"/output/datasink_handson/normalized/sub-07/f-contr_activation.png\",\n",
10011002
" colorbar=True, display_mode='lyrz', black_bg=True, threshold=25,\n",
1002-
" title='subject 7 - F-contrast: Activation');"
1003+
" title='subject 7 - F-contrast: Activation');\n",
1004+
"\n",
1005+
"Image(filename='/output/datasink_handson/normalized/sub-07/f-contr_activation.png')"
10031006
]
10041007
},
10051008
{
@@ -1009,8 +1012,11 @@
10091012
"outputs": [],
10101013
"source": [
10111014
"plot_glass_brain('/output/datasink_handson/normalized/sub-07/wess_0009.nii',\n",
1015+
" output_file=\"/output/datasink_handson/normalized/sub-07/f-contr_differences.png\",\n",
10121016
" colorbar=True, display_mode='lyrz', black_bg=True, threshold=25,\n",
1013-
" title='subject 7 - F-contrast: Differences');"
1017+
" title='subject 7 - F-contrast: Differences');\n",
1018+
"\n",
1019+
"Image(filename='/output/datasink_handson/normalized/sub-07/f-contr_differences.png')"
10141020
]
10151021
},
10161022
{
@@ -1648,7 +1654,7 @@
16481654
"metadata": {
16491655
"anaconda-cloud": {},
16501656
"kernelspec": {
1651-
"display_name": "Python [default]",
1657+
"display_name": "Python 3",
16521658
"language": "python",
16531659
"name": "python3"
16541660
},
@@ -1662,7 +1668,7 @@
16621668
"name": "python",
16631669
"nbconvert_exporter": "python",
16641670
"pygments_lexer": "ipython3",
1665-
"version": "3.6.5"
1671+
"version": "3.7.8"
16661672
}
16671673
},
16681674
"nbformat": 4,

test_notebooks.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import os
21
import sys
3-
import time
42
from glob import glob
3+
import pytest
54

65
def test_version():
76
import nipype
@@ -90,7 +89,6 @@ def reduce_notebook_load(path):
9089
print('Reducing: %s' % n)
9190
notebooks.append(reduce_notebook_load(n))
9291

93-
for test in notebooks:
94-
pytest_cmd = 'pytest --nbval-lax --nbval-cell-timeout 7200 -v -s %s' % test
95-
print(pytest_cmd)
96-
os.system(pytest_cmd)
92+
# testing all tests from the notebooks list
93+
pytest_exit_code = pytest.main(["--nbval-lax", "--nbval-cell-timeout", "7200", "-vs"] + notebooks)
94+
sys.exit(pytest_exit_code)

0 commit comments

Comments
 (0)