Skip to content

Commit

Permalink
Merge pull request #610 from davidbrochart/cell_error
Browse files Browse the repository at this point in the history
Don't return resources
  • Loading branch information
maartenbreddels committed May 20, 2020
2 parents 0d5d6f2 + 19b711c commit 80b120c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tests/app/syntax_error_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest


@pytest.fixture
def syntax_error_notebook(base_url):
return base_url + "voila/render/syntax_error.ipynb"


@pytest.fixture
def voila_args(notebook_directory, voila_args_extra):
return ['--VoilaTest.root_dir=%r' % notebook_directory] + voila_args_extra


async def test_syntax_error(capsys, http_server_client, syntax_error_notebook):
response = await http_server_client.fetch(syntax_error_notebook)
assert response.code == 200
assert 'There was an error when executing cell' in response.body.decode('utf-8')
34 changes: 34 additions & 0 deletions tests/notebooks/syntax_error.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"this is a syntax error"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.8.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion voila/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async def execute_cell(self, cell, resources, cell_index, store_history=True):
raise e
except CellExecutionError as e:
self.log.error(e)
result = (cell, resources)
result = cell

# Strip errors and traceback if not in debug mode
if should_strip_error(self.config):
Expand Down

0 comments on commit 80b120c

Please sign in to comment.