Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run doctests only when using pinned requirements for most recent Python version #2468

Closed
namurphy opened this issue Jan 17, 2024 · 1 comment
Labels
documentation infrastructure Plasma Lv0 | Novice Issues that do not require knowledge of physics priority: low Issues & PRs of low urgency and importance that may be deferred until later Python Lv3 | Proficient Issues that require proficiency in Python refactoring ♻️ Improving an implementation without adding new functionality

Comments

@namurphy
Copy link
Member

Description of improvement

Instead of running doctests every time we run tests, we should consider switching to running doctests only on the pinned requirements in requirements.txt that get updated via an automated PR every week.

Motivation

Sometimes upstream packages like NumPy and Astropy change how they print out things like ndarray and Quantity objects. If we ran doctests only on a single updated set of package versions, we wouldn't have to do any version-dependent skipping of doctests.

Since we currently run code coverage on an older version of the tests, a consequence of this change would be that lines of code covered only by doctests would no longer show up as being covered by tests. This would help us avoid situations where certain lines of code are only run during doctests and not in our standard test suite, or a function is only tested in doctests.

Implementation strategy

The change would be in tox.ini and/or .github/workflows/tests.yml. Might be easiest to try getting ChatGPT to do this one for us. It would probably involve changing the flags provided to pytest.

Additional context

See also #135, #229, #653, #2148, astropy/astropy#14553, astropy/astropy#15095, astropy/astropy#15312

@namurphy namurphy added priority: low Issues & PRs of low urgency and importance that may be deferred until later refactoring ♻️ Improving an implementation without adding new functionality documentation infrastructure Python Lv3 | Proficient Issues that require proficiency in Python Plasma Lv0 | Novice Issues that do not require knowledge of physics labels Jan 17, 2024
@namurphy namurphy changed the title Run doctests only when using pinned requirements Run doctests only when using pinned requirements for most recent Python version Feb 28, 2024
@namurphy
Copy link
Member Author

Closed by #2523.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation infrastructure Plasma Lv0 | Novice Issues that do not require knowledge of physics priority: low Issues & PRs of low urgency and importance that may be deferred until later Python Lv3 | Proficient Issues that require proficiency in Python refactoring ♻️ Improving an implementation without adding new functionality
Projects
None yet
Development

No branches or pull requests

1 participant