From 6938a7122fba36815e08c7bdd50dd58ba4728251 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Wed, 20 May 2020 12:32:33 +0200 Subject: [PATCH 1/2] Don't return resources --- voila/execute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voila/execute.py b/voila/execute.py index 177e39f34..032196266 100644 --- a/voila/execute.py +++ b/voila/execute.py @@ -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): From 19b711c00bcac72dffde7ef677201e254180e66e Mon Sep 17 00:00:00 2001 From: David Brochart Date: Wed, 20 May 2020 17:26:41 +0200 Subject: [PATCH 2/2] Add test --- tests/app/syntax_error_test.py | 17 +++++++++++++++ tests/notebooks/syntax_error.ipynb | 34 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/app/syntax_error_test.py create mode 100644 tests/notebooks/syntax_error.ipynb diff --git a/tests/app/syntax_error_test.py b/tests/app/syntax_error_test.py new file mode 100644 index 000000000..e395f7a74 --- /dev/null +++ b/tests/app/syntax_error_test.py @@ -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') diff --git a/tests/notebooks/syntax_error.ipynb b/tests/notebooks/syntax_error.ipynb new file mode 100644 index 000000000..a26cb8a30 --- /dev/null +++ b/tests/notebooks/syntax_error.ipynb @@ -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 +}