Skip to content

Conversation

@strawgate
Copy link
Contributor

@strawgate strawgate commented Dec 19, 2025

Require formatted and runnable examples in docstrings and documentation, and bring the documentation and code up to compliance with these new requirements. Closes #1587

Uses pytest-examples to ensure that examples in docstrings and documentation are properly formatted and runnable with assertions on any print statements in the example. Adds pytest-timeout to the dev dependencies which is used to prevent example tests from running forever if they hit blocking code.

There are zero lines of actual code changed outside the test_docs.py. The majority of the PR is imports organization, linting, formatting, and ensuring that examples are runnable or ensuring we skip examples that should not be linted or that should not be run (either because they are incomplete examples, require internet access or an external connection, or are blocking).

There are ~300 newly passing tests and ~140 skipped tests (examples that are not checked for formatting or if they are runnable).

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@strawgate strawgate changed the title [Draft] Add pytest-examples [Draft] Require formatted and runable examples in docstrings and documentation Dec 20, 2025
@strawgate strawgate changed the title [Draft] Require formatted and runable examples in docstrings and documentation Require formatted and runable examples in docstrings and documentation Dec 20, 2025
@strawgate strawgate changed the title Require formatted and runable examples in docstrings and documentation Require formatted and runnable examples in docstrings and documentation Dec 20, 2025
@strawgate strawgate changed the title Require formatted and runnable examples in docstrings and documentation Enforce working examples in docstrings and documentation Dec 20, 2025
@strawgate strawgate marked this pull request as draft January 17, 2026 04:52
@strawgate
Copy link
Contributor Author

Hey sorry, should have left this in draft, I'll pick this back up and get it ready to be merged

@strawgate strawgate marked this pull request as ready for review January 17, 2026 18:52
@strawgate strawgate requested a review from alexmojaki January 17, 2026 18:53
@strawgate
Copy link
Contributor Author

@alexmojaki thanks for the review, I think this is looking better now.

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.

Add pytest-examples to verify documentation examples

2 participants