Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH] Add test to validate execution of README Python examples#713

Merged
fkiraly merged 3 commits intoPyPortfolio:mainfrom
PredictiveManish:Test-README
Mar 8, 2026
Merged

[ENH] Add test to validate execution of README Python examples#713
fkiraly merged 3 commits intoPyPortfolio:mainfrom
PredictiveManish:Test-README

Conversation

Copy link
Contributor

PredictiveManish commented Feb 27, 2026

Adds a pytest that parses README.md and executes all python code blocks to ensure examples remain valid.

Closes #669

  • Uses regex to extract Python blocks
  • Executes them sequentially in a shared namespace (since examples are stateful)
  • Runs from repo root so relative paths like tests/resources/... resolve correctly
  • Adds repo root to sys.path so pypfopt can be imported without installation

This verifies that README examples run as documented and helps prevent regressions in imports or usage.

fkiraly added the enhancement New feature or request label Feb 27, 2026
Copy link
Contributor Author

PredictiveManish commented Feb 27, 2026 *
edited
Loading

The extra file changes occurred when I started working on the CI failure issue, as Ruff auto-formatting modified some files.

and as it's not any logic break or any particular change so I added them here.

fkiraly approved these changes Mar 8, 2026
fkiraly merged commit 63e8268 into PyPortfolio:main Mar 8, 2026
39 checks passed
Copy link
Contributor Author

PredictiveManish commented Mar 8, 2026

Thanks @fkiraly

PredictiveManish deleted the Test-README branch March 8, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

fkiraly fkiraly approved these changes

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[ENH] add tests for correctness of code in README

2 participants