Skip to content

Commit 7d32934

Browse files
Update test_notebooks.py
1 parent 3623446 commit 7d32934

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

tools/test_notebooks.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,16 @@ def should_skip(notebook_path: str, skip_list: List[str]) -> bool:
1616

1717

1818
def run_notebook(notebook_path: str, root: str) -> Tuple[bool, Optional[str]]:
19-
"""Execute a single notebook and print outputs of each cell."""
19+
"""Execute a single notebook."""
2020
try:
2121
print(f"🔧 running: {notebook_path}")
2222
with open(notebook_path, encoding="utf-8") as f:
2323
nb = nbformat.read(f, as_version=4)
2424

25-
ep = ExecutePreprocessor(timeout=SINGLE_NOTEBOOK_TIMEOUT, kernel_name="python3")
25+
ep = ExecutePreprocessor(
26+
timeout=SINGLE_NOTEBOOK_TIMEOUT,
27+
kernel_name="python3")
2628
ep.preprocess(nb, {"metadata": {"path": root}})
27-
28-
# Print outputs of each cell
29-
for i, cell in enumerate(nb.cells):
30-
if cell.cell_type == 'code':
31-
print(f"\n📦 Cell {i + 1}:\n{cell.source.strip()}")
32-
for output in cell.get('outputs', []):
33-
if output.output_type == 'stream':
34-
print(output.text)
35-
elif output.output_type == 'error':
36-
print("❌ Error:")
37-
print("\n".join(output.get('traceback', [])))
38-
elif output.output_type == 'execute_result':
39-
data = output.get('data', {})
40-
if 'text/plain' in data:
41-
print(data['text/plain'])
42-
elif output.output_type == 'display_data':
43-
data = output.get('data', {})
44-
if 'text/plain' in data:
45-
print(data['text/plain'])
46-
4729
return True, None
4830
except Exception as e:
4931
return False, str(e)

0 commit comments

Comments
 (0)