Skip to content

Test notebook courses - #3697

Draft
Andrew Casey (amcasey) wants to merge 1 commit into
mainfrom
amcasey/NotebookTest
Draft

Test notebook courses#3697
Andrew Casey (amcasey) wants to merge 1 commit into
mainfrom
amcasey/NotebookTest

Conversation

@amcasey

Copy link
Copy Markdown
Member

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.

@HABER7789 Dhairya Patel (HABER7789) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@amcasey

Andrew Casey (amcasey) commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

This will need to be rebased on top of #3700.

Edit: done

@amcasey

Copy link
Copy Markdown
Member Author

Can you please give it another test now that I've rebased, Dhairya Patel (@HABER7789)?

Base automatically changed from chemistry-qpe-2.2 to main September 9, 2026 21:07
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`.
Comment thread .github/workflows/ci.yml
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.arch }}
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-test handling 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.

Comment on lines +36 to +43
@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)
@amcasey
Andrew Casey (amcasey) marked this pull request as draft September 12, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants