-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set cwd of kernel and pass to nbconvert
- Loading branch information
1 parent
807f635
commit 8cb9cda
Showing
7 changed files
with
129 additions
and
2 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,18 @@ | ||
# test serving a notebook | ||
import pytest | ||
|
||
@pytest.fixture | ||
def cwd_subdit_notebook_url(base_url): | ||
return base_url + "/voila/render/subdir/cwd_subdir" | ||
|
||
@pytest.fixture | ||
def voila_args(notebook_directory, voila_args_extra): | ||
return ['--VoilaTest.root_dir=%r' % notebook_directory, '--VoilaTest.log_level=DEBUG'] + voila_args_extra | ||
|
||
|
||
@pytest.mark.gen_test | ||
def test_hello_world(http_client, cwd_subdit_notebook_url): | ||
response = yield http_client.fetch(cwd_subdit_notebook_url) | ||
html_text = response.body.decode('utf-8') | ||
assert 'check for the cwd' in html_text | ||
|
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,16 @@ | ||
# tests the --template argument of voila | ||
import pytest | ||
import base64 | ||
import os | ||
|
||
@pytest.fixture | ||
def voila_notebook(notebook_directory): | ||
return os.path.join(notebook_directory, 'cwd.ipynb') | ||
|
||
|
||
@pytest.mark.gen_test | ||
def test_template_cwd(http_client, base_url, notebook_directory): | ||
response = yield http_client.fetch(base_url) | ||
html_text = response.body.decode('utf-8') | ||
assert 'check for the cwd' in html_text | ||
|
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,35 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with open('./file.txt') as f:\n", | ||
" print(f.read())" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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 @@ | ||
check for the cwd |
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,35 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with open('..//file.txt') as f:\n", | ||
" print(f.read())" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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,19 @@ | ||
# NOTE: this is a duplicate of ../app/cwd_subdir_test.py | ||
# we might want to find a better pattern of executing test for the app and extension | ||
import pytest | ||
|
||
@pytest.fixture | ||
def cwd_subdit_notebook_url(base_url): | ||
return base_url + "/voila/render/subdir/cwd_subdir" | ||
|
||
@pytest.fixture | ||
def voila_args(notebook_directory, voila_args_extra): | ||
return ['--VoilaTest.root_dir=%r' % notebook_directory, '--VoilaTest.log_level=DEBUG'] + voila_args_extra | ||
|
||
|
||
@pytest.mark.gen_test | ||
def test_hello_world(http_client, cwd_subdit_notebook_url): | ||
response = yield http_client.fetch(cwd_subdit_notebook_url) | ||
html_text = response.body.decode('utf-8') | ||
assert 'check for the cwd' in html_text | ||
|
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