Skip to content

fix: add readme tests + doc dry run#827

Merged
speller26 merged 19 commits intoamazon-braket:mainfrom
sesmart:add-readme-tests
Jan 30, 2026
Merged

fix: add readme tests + doc dry run#827
speller26 merged 19 commits intoamazon-braket:mainfrom
sesmart:add-readme-tests

Conversation

@sesmart
Copy link
Copy Markdown
Contributor

@sesmart sesmart commented Jan 30, 2026

Issue #, if available:

Currently no error if new notebooks are still just added to the README.md; which circumvents the doc build. This adds appropriate tests.

Close #802

Description of changes:

  1. check doc build is run from correct directory
  2. add dry run flag to not write new docs
  3. tests for (1) ENTRIES.json matches README, (2) doc build runs successfully
  4. restores cwd after notebook testing
  5. reorder pyproject to run repo_tests first and fast fail; saves CI time

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sesmart sesmart requested review from AbeCoull and speller26 January 30, 2026 14:34
@sesmart sesmart requested a review from a team as a code owner January 30, 2026 14:34
Copy link
Copy Markdown
Member

@speller26 speller26 left a comment

Choose a reason for hiding this comment

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

super nits

Copy link
Copy Markdown
Member

@speller26 speller26 left a comment

Choose a reason for hiding this comment

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

minor comments

@pytest.fixture(autouse=True)
def restore_cwd():
original_cwd = os.getcwd()
yield
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Out of curiosity, why is this needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here, every time chdir is called it moves, the working directory moves, which is why it effectively is reset at the beginning of each test. here you could just remove that line from each test I believe. the problem would be when this notebook is not run last, that it affects repo_test, but it's not consistent with pytest or os.

Actually might need to adjust it slightly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cleaned it up, but it's a minor point - previously it would have moved at the beginning of each test, here we just move back at the end.


try:
os.chdir(root_path)
sys.path.insert(0, str(root_path / "docs"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did not know this syntax worked

Copy link
Copy Markdown
Contributor Author

@sesmart sesmart Jan 30, 2026

Choose a reason for hiding this comment

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

Same until today 😅

@sesmart sesmart requested a review from speller26 January 30, 2026 20:15
@speller26 speller26 merged commit 9badfdd into amazon-braket:main Jan 30, 2026
9 checks passed
sesmart added a commit that referenced this pull request Feb 11, 2026
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.

Update tests for README generation

2 participants