Skip to content

Commit ab4bfd3

Browse files
authored
tests(cookbooks): Save executed notebooks to github cache for debugging. (#707)
1 parent e4acc3e commit ab4bfd3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/tests-cookbook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: actions/upload-artifact@v4
4242
if: always()
4343
with:
44-
path: "docs/cookbook/*.ipynb"
44+
path: "docs/cookbook/executed_*.ipynb"
4545

4646
- name: Upload coverage reports to Codecov
4747
if: always()

tests/cookbooks/test_cookbooks.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
list(pathlib.Path("docs/cookbook").glob("*.ipynb")),
1111
ids=lambda x: x.stem,
1212
)
13-
@pytest.mark.timeout(220)
13+
@pytest.mark.timeout(180)
1414
def test_cookbook_notebook(
1515
notebook_path: pathlib.Path, capsys: pytest.CaptureFixture
1616
) -> None:
@@ -21,7 +21,14 @@ def test_cookbook_notebook(
2121
pytest.skip("See https://github.com/mozilla-ai/any-agent/issues/706")
2222
try:
2323
result = subprocess.run( # noqa: S603
24-
["jupyter", "execute", notebook_path.name], # noqa: S607
24+
[ # noqa: S607
25+
"jupyter",
26+
"execute",
27+
notebook_path.name,
28+
"--allow-errors",
29+
"--output",
30+
f"executed_{notebook_path.name}",
31+
],
2532
cwd="docs/cookbook", # Run in cookbook directory like original action
2633
env={
2734
"MISTRAL_API_KEY": os.environ["MISTRAL_API_KEY"],
@@ -30,7 +37,7 @@ def test_cookbook_notebook(
3037
"PATH": os.environ["PATH"],
3138
"IN_PYTEST": "1", # For mcp_agent notebook which needs to mock input
3239
},
33-
timeout=210, # Time out slightly earlier so that we can log the output.
40+
timeout=170, # Time out slightly earlier so that we can log the output.
3441
capture_output=True,
3542
check=False,
3643
)

0 commit comments

Comments
 (0)