Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tutorial/tests/testsuite/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import ipywidgets
import pytest
from _pytest.outcomes import Failed
from IPython.display import Code
from IPython.display import display as ipython_display
from ipywidgets import HTML
Expand Down Expand Up @@ -275,8 +276,15 @@ def to_html(self) -> str:
status_text = "Failed"
case TestOutcome.TEST_ERROR:
status_class = "test-error"
icon = "🚨"
status_text = "Syntax Error"
if isinstance(self.exception, SyntaxError):
icon = "🚨"
status_text = "Syntax Error"
else:
icon = "⚠️"
exc_name = (
type(self.exception).__name__ if self.exception else "Error"
)
status_text = f"Runtime Error ({exc_name})"
case _:
status_class = "test-error"
icon = "⚠️"
Expand Down Expand Up @@ -768,6 +776,7 @@ def pytest_exception_interact(
TestOutcome.FAIL
if exc.errisinstance(AssertionError)
or exc.errisinstance(pytest.fail.Exception)
or exc.errisinstance(Failed)
else TestOutcome.TEST_ERROR
)
self.tests[report.nodeid] = TestCaseResult(
Expand Down
15 changes: 0 additions & 15 deletions tutorial/tests/testsuite/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
IPytestOutcome,
IPytestResult,
ResultCollector,
TestOutcome,
TestResultOutput,
)

Expand Down Expand Up @@ -66,20 +65,6 @@ def run_pytest_for_function(
test_results=list(result_collector.tests.values()),
)
case pytest.ExitCode.TESTS_FAILED:
if any(
test.outcome == TestOutcome.TEST_ERROR
for test in result_collector.tests.values()
):
return IPytestResult(
function=function,
status=IPytestOutcome.PYTEST_ERROR,
exceptions=[
test.exception
for test in result_collector.tests.values()
if test.exception
],
)

return IPytestResult(
function=function,
status=IPytestOutcome.FINISHED,
Expand Down