-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from maartenbreddels/feat_show_stacktrace_ext
feat: allow showing of stacktraces in server extension mode
- Loading branch information
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