forked from voila-dashboards/voila
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow showing of stacktraces in server extension mode
Closes voila-dashboards#751 This is a followup of voila-dashboards#630
- Loading branch information
1 parent
6bcc277
commit 29646f3
Showing
8 changed files
with
72 additions
and
17 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,23 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture(params=[True, False]) | ||
def show_tracebacks(request): | ||
return request.param | ||
|
||
|
||
@pytest.fixture | ||
def voila_args(notebook_directory, voila_args_extra, show_tracebacks): | ||
return ['--VoilaTest.root_dir=%r' % notebook_directory, f'--VoilaConfiguration.show_tracebacks={show_tracebacks}'] + voila_args_extra | ||
|
||
|
||
async def test_syntax_error(http_server_client, syntax_error_notebook_url, show_tracebacks): | ||
response = await http_server_client.fetch(syntax_error_notebook_url) | ||
assert response.code == 200 | ||
output = response.body.decode('utf-8') | ||
if show_tracebacks: | ||
assert 'this is a syntax error' in output, 'should show the "code"' | ||
assert 'SyntaxError' in output and 'invalid syntax' in output, "should show the error" | ||
else: | ||
assert 'There was an error when executing cell' in output | ||
assert 'This should not be executed' not in output |
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,23 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture(params=[True, False]) | ||
def show_tracebacks(request): | ||
return request.param | ||
|
||
|
||
@pytest.fixture | ||
def jupyter_server_args_extra(show_tracebacks): | ||
return [f'--VoilaConfiguration.show_tracebacks={show_tracebacks}'] | ||
|
||
|
||
async def test_syntax_error(http_server_client, syntax_error_notebook_url, show_tracebacks): | ||
response = await http_server_client.fetch(syntax_error_notebook_url) | ||
assert response.code == 200 | ||
output = response.body.decode('utf-8') | ||
if show_tracebacks: | ||
assert 'this is a syntax error' in output, 'should show the "code"' | ||
assert 'SyntaxError' in output and 'invalid syntax' in output, "should show the error" | ||
else: | ||
assert 'There was an error when executing cell' in output | ||
assert 'This should not be executed' not in output |
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
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