-
Notifications
You must be signed in to change notification settings - Fork 72
Updated notebook test action #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe GitHub Actions workflow for testing notebooks was updated by renaming a job and restricting the scope of tested notebooks to those in the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/test-notebooks.yml (1)
14-15: Job name no longer conveys runtime details
test-lnxis generic, while the workflow still pins Python 3.10. If other jobs use different Python versions, consider encoding the version (e.g.,test-lnx-py310) or adding astrategy.matrix.python-versionso the name stays meaningful over time.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/test-notebooks.yml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-test
| - name: Testing notebooks | ||
| run: | | ||
| for f in docs/source/*.ipynb | ||
| for f in docs/source/user_guide/*.ipynb | ||
| do | ||
| jupyter nbconvert --to notebook --inplace --execute $f || (echo "$f" >> failed_nbs.txt) | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Harden the loop against “no match” cases and allow sub-directories
If no notebook matches docs/source/user_guide/*.ipynb, the glob is left literally in $f, and nbconvert fails the job even though there are simply no notebooks.
Activate nullglob (or use find) and optionally recurse into sub-folders:
- for f in docs/source/user_guide/*.ipynb
+ shopt -s nullglob # empty globs expand to nothing
+ for f in docs/source/user_guide/**/*.ipynb
do
jupyter nbconvert --to notebook --inplace --execute "$f" || (echo "$f" >> failed_nbs.txt)
doneThis avoids false failures and future-proofs the path structure.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Testing notebooks | |
| run: | | |
| for f in docs/source/*.ipynb | |
| for f in docs/source/user_guide/*.ipynb | |
| do | |
| jupyter nbconvert --to notebook --inplace --execute $f || (echo "$f" >> failed_nbs.txt) | |
| done | |
| - name: Testing notebooks | |
| run: | | |
| shopt -s nullglob # empty globs expand to nothing | |
| for f in docs/source/user_guide/**/*.ipynb | |
| do | |
| jupyter nbconvert --to notebook --inplace --execute "$f" || (echo "$f" >> failed_nbs.txt) | |
| done |
🤖 Prompt for AI Agents
In .github/workflows/test-notebooks.yml around lines 30 to 35, the shell loop
over notebooks fails if no files match the glob pattern, causing false failures.
To fix this, enable the shell option `nullglob` before the loop to ensure the
glob expands to an empty list if no matches exist, preventing the loop from
running with a literal pattern. Additionally, modify the loop to recursively
find notebooks in subdirectories, for example by using `find` with appropriate
path and extension filters, so it covers all notebooks under the directory tree.
Summary by CodeRabbit