Test notebook courses - #3697
Conversation
Dhairya Patel (HABER7789)
left a comment
There was a problem hiding this comment.
Ran all the thirteen tests. The skip-test tag is a nice addition for the slow cells! and the orbital values also match as expected.
|
This will need to be rebased on top of #3700. Edit: done |
be5d0a3 to
285f947
Compare
285f947 to
1cdd2d7
Compare
|
Can you please give it another test now that I've rebased, Dhairya Patel (@HABER7789)? |
Code cells should run without exceptions, except those tagged `exercise`, which should fail with `ExerciseError` (not having been completed). Some cells are very slow - we tag those `skip-test`.
1cdd2d7 to
20270b4
Compare
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| architecture: ${{ matrix.arch }} | ||
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
There was a problem hiding this comment.
I'm not convinced we need/want this. I assume it was based on the caching used for cargo above. Can you please have a look, Ian Davis (@idavis)?
There was a problem hiding this comment.
🟡 Changes recommended
The isolation fixture derives the course root from a fixed notebook depth despite supporting recursive discovery.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds automated execution testing for QDK course notebooks.
Changes:
- Adds notebook execution and policy validation.
- Runs Chemistry QPE notebooks across four CI architectures.
- Introduces
skip-testhandling and concise exercise tracebacks.
File summaries
| File | Description |
|---|---|
.github/workflows/ci.yml |
Adds conditional multi-platform notebook tests. |
source/vscode/test/course-notebooks/README.md |
Documents setup and cell tags. |
source/vscode/test/course-notebooks/conftest.py |
Discovers and isolates course notebooks. |
source/vscode/test/course-notebooks/notebook_runner.py |
Executes notebooks and reports policy failures. |
source/vscode/test/course-notebooks/requirements.txt |
Declares test dependencies. |
source/vscode/test/course-notebooks/test_course_notebooks.py |
Tests discovered course notebooks. |
source/vscode/test/course-notebooks/test_notebook_runner.py |
Tests cell-policy handling. |
source/vscode/src/learning/notebookExercises.ts |
Removes test-only tags from learner copies. |
source/vscode/resources/qdk-learning/utils/chemistry-qpe/rst_to_notebook.py |
Generates skipped test cells. |
source/vscode/resources/qdk-learning/courses/chemistry-qpe/06-iterative-phase-estimation/iterative_phase_estimation.ipynb |
Skips the expensive workflow cell in tests. |
source/vscode/resources/qdk-learning/courses/chemistry-qpe/_course_lib.py |
Suppresses exercise traceback rendering. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @pytest.fixture | ||
| def isolated_course_notebook( | ||
| course_notebook: Path, | ||
| tmp_path: Path, | ||
| ) -> tuple[Path, Path]: | ||
| course_dir = course_notebook.parents[1] | ||
| copied_course_dir = tmp_path / course_dir.name | ||
| shutil.copytree(course_dir, copied_course_dir) |
Code cells should run without exceptions, except those tagged
exercise, which should fail withExerciseError(not having been completed).Some cells are very slow - we tag those
skip-test.