-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement outline of Jupyter testing.
- Loading branch information
Showing
4 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"source": [ | ||
"# Welcome to the interactive Galaxy IPython Notebook." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"source": [ | ||
"You can access your data via the dataset number. For example, ``handle = open(get(42), 'r')``.\n", | ||
"To save data, write your data to a file, and then call ``put('filename.txt')``. The dataset will then be available in your galaxy history.\n", | ||
"Notebooks can be saved to Galaxy by clicking the large green button at the top right of the IPython interface.<br>\n", | ||
"More help and informations can be found on the project [website](https://github.com/bgruening/galaxy-ipython)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'/import/1'" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"get(1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"chr6_hla_hap2 0 150\r\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!grep chr6 /import/1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!echo \"Hello World\" > /tmp/cow" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"put(\"/tmp/cow\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 16, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1 [2] 1.txt.gg ipython_galaxy_notebook.ipynb\r\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!ls /import" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 17, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"put(\"/import/ipython_galaxy_notebook.ipynb\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from .framework import ( | ||
managed_history, | ||
selenium_test, | ||
SeleniumTestCase, | ||
) | ||
|
||
JUPYTER_VISUALIZATION_NAME = "Jupyter" | ||
|
||
|
||
class JupyterTestCase(SeleniumTestCase): | ||
|
||
ensure_registered = True | ||
|
||
@selenium_test | ||
@managed_history | ||
def test_jupyter_session(self): | ||
self.perform_upload(self.get_filename("1.txt")) | ||
self.perform_upload(self.get_filename("selenium-test-notebook.ipynb")) | ||
self.wait_for_history() | ||
self.history_panel_ensure_showing_item_details(2) | ||
self.history_panel_item_click_visualization_menu(2) | ||
self.ensure_visualization_available(2, JUPYTER_VISUALIZATION_NAME) | ||
self.history_panel_item_click_visualization(2, JUPYTER_VISUALIZATION_NAME) | ||
with self.main_panel(): | ||
viz_iframe = self.wait_for_selector("body iframe", wait_type=self.wait_types.GIE_SPAWN) | ||
try: | ||
self.driver.switch_to.frame(viz_iframe) | ||
self.wait_for_selector("ul.nav") | ||
lis = self.driver.find_elements_by_css_selector("ul.nav li.dropdown") | ||
cell_li = None | ||
for li in lis: | ||
if li.text == "Cell": | ||
cell_li = li | ||
break | ||
cell_li.click() | ||
self.wait_for_and_click_selector("ul#cell_menu li#run_all_cells") | ||
finally: | ||
self.driver.switch_to.default_content() | ||
|
||
# TODO: wait on something in the notebook instead of sleeping so long. | ||
self.sleep_for(wait_type=self.wait_types.JOB_COMPLETION) | ||
self.history_panel_refresh_click() | ||
|
||
# Re-running notebook should publish two new things to the history. | ||
self.history_panel_wait_for_hid_ok(3) | ||
self.history_panel_wait_for_hid_ok(4) |