Skip to content

Commit

Permalink
Fix Jupyter Notebook pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Feb 15, 2020
1 parent 6983924 commit e676504
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ install:
- pip install tables pytest nbval django
- python setup.py install
test_script:
- pytest --nbval
- pytest --nbval doc/tutorial.ipynb --sanitize-with doc/pytest-sanitize.ini
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before_install:
install:
- python setup.py install
script:
- pytest --nbval --cov=thunor
- pytest --nbval doc/tutorial.ipynb --sanitize-with doc/pytest-sanitize.ini --cov=thunor
after_success:
- codecov
deploy:
Expand Down
3 changes: 3 additions & 0 deletions doc/pytest-sanitize.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Section1]
regex: [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
replace: __plotly_uuid__
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ https://github.com/Juanlu001/sphinx_rtd_theme/archive/js-head.zip
nbsphinx
jupyter_client
notebook
nbformat>4,<5 # https://github.com/plotly/plotly.py/issues/692
numpy
scipy
plotly==4.5.0
Expand Down
24 changes: 11 additions & 13 deletions doc/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"outputs": [],
"source": [
"# If the import doesn't work, uncomment the following two lines, or \"pip install thunor\"\n",
"# import os, sys\n",
"# sys.path.insert(0, os.path.abspath('../'))\n",
"import os, sys\n",
"sys.path.insert(0, os.path.abspath('../'))\n",
"\n",
"import thunor"
]
Expand Down Expand Up @@ -178,9 +178,7 @@
"metadata": {},
"outputs": [],
"source": [
"from thunor.plots import plot_drc, plot_drc_params, plot_time_course, plot_ctrl_dip_by_plate, plot_plate_map\n",
"from plotly.offline import plot, iplot, init_notebook_mode\n",
"init_notebook_mode()"
"from thunor.plots import plot_drc, plot_drc_params, plot_time_course, plot_ctrl_dip_by_plate, plot_plate_map"
]
},
{
Expand All @@ -198,7 +196,7 @@
"metadata": {},
"outputs": [],
"source": [
"iplot(plot_drc(fp))"
"plot_drc(fp)"
]
},
{
Expand All @@ -216,7 +214,7 @@
"metadata": {},
"outputs": [],
"source": [
"iplot(plot_drc_params(fp, 'auc'))"
"plot_drc_params(fp, 'auc')"
]
},
{
Expand All @@ -237,7 +235,7 @@
"fit_params_bt20_pac = fp[fp.index.isin(['BT20'], level='cell_line') & \\\n",
" fp.index.isin(['paclitaxel'], level='drug')]\n",
"\n",
"iplot(plot_drc(fit_params_bt20_pac))"
"plot_drc(fit_params_bt20_pac)"
]
},
{
Expand All @@ -255,9 +253,9 @@
"metadata": {},
"outputs": [],
"source": [
"iplot(plot_time_course(\n",
"plot_time_course(\n",
" hts007.filter(drugs=['paclitaxel'], cell_lines=['BT20'])\n",
"))"
")"
]
},
{
Expand All @@ -275,7 +273,7 @@
},
"outputs": [],
"source": [
"iplot(plot_ctrl_dip_by_plate(ctrl_dip_data))"
"plot_ctrl_dip_by_plate(ctrl_dip_data)"
]
},
{
Expand All @@ -300,7 +298,7 @@
"metadata": {},
"outputs": [],
"source": [
"iplot(plot_plate_map(plate_data, color_by='dip_rates'))"
"plot_plate_map(plate_data, color_by='dip_rates')"
]
}
],
Expand All @@ -320,7 +318,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.8.1"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
url='https://www.thunor.net',
packages=['thunor'],
install_requires=['numpy', 'scipy', 'pandas', 'plotly==4.5.0', 'seaborn', 'tables'],
tests_require=['pytest', 'nbval', 'django'],
tests_require=['pytest', 'nbval', 'django', 'nbformat>4,<5'],
cmdclass=versioneer.get_cmdclass(),
zip_safe=True,
classifiers=[
Expand Down

0 comments on commit e676504

Please sign in to comment.