Skip to content

Commit

Permalink
Fix debug mode persistency issue (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardob90 authored Nov 29, 2024
1 parent a6a77f7 commit a8d14c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tutorial/tests/testsuite/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def __init__(self, shell):
super().__init__(shell)
self.shell: InteractiveShell = shell
self.cell: str = ""
self.debug: bool = False
self.module_file: Optional[pathlib.Path] = None
self.module_name: Optional[str] = None
self.threaded: Optional[bool] = None
Expand Down Expand Up @@ -271,17 +270,17 @@ def ipytest(self, line: str, cell: str):
line_contents = set(line.split())

# Debug mode?
if "debug" in line_contents:
debug = "debug" in line_contents
if debug:
line_contents.remove("debug")
self.debug = True

# Check if we need to run the tests on a separate thread
if "async" in line_contents:
line_contents.remove("async")
self.threaded = True
self.test_queue = Queue()

with self.traceback_handling(self.debug):
with self.traceback_handling(debug):
# Get the module containing the test(s)
if (
module_name := get_module_name(
Expand All @@ -306,7 +305,7 @@ def ipytest(self, line: str, cell: str):
results = self.run_cell()

# If in debug mode, display debug information first
if self.debug:
if debug:
debug_output = DebugOutput(
module_name=self.module_name,
module_file=self.module_file,
Expand Down

0 comments on commit a8d14c5

Please sign in to comment.