8000 Fix debug mode persistency issue (#276) · edoardob90/python-tutorial@a8d14c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a8d14c5

Browse files
authored
Fix debug mode persistency issue (empa-scientific-it#276)
1 parent a6a77f7 commit a8d14c5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tutorial/tests/testsuite/testsuite.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ def __init__(self, shell):
151151
super().__init__(shell)
152152
self.shell: InteractiveShell = shell
153153
self.cell: str = ""
154-
self.debug: bool = False
155154
self.module_file: Optional[pathlib.Path] = None
156155
self.module_name: Optional[str] = None
157156
self.threaded: Optional[bool] = None
@@ -271,17 +270,17 @@ def ipytest(self, line: str, cell: str):
271270
line_contents = set(line.split())
272271

273272
# Debug mode?
274-
if "debug" in line_contents:
273+
debug = "debug" in line_contents
274+
if debug:
275275
line_contents.remove("debug")
276-
self.debug = True
277276

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

284-
with self.traceback_handling(self.debug):
283+
with self.traceback_handling(debug):
285284
# Get the module containing the test(s)
286285
if (
287286
module_name := get_module_name(
@@ -306,7 +305,7 @@ def ipytest(self, line: str, cell: str):
306305
results = self.run_cell()
307306

308307
# If in debug mode, display debug information first
309-
if self.debug:
308+
if debug:
310309
debug_output = DebugOutput(
311310
module_name=self.module_name,
312311
module_file=self.module_file,

0 commit comments

Comments
 (0)
0