Skip to content

Enable context-aware warnings for the freethreaded CI run#19861

Open
ayshih wants to merge 3 commits into
astropy:mainfrom
ayshih:context_aware_warnings
Open

Enable context-aware warnings for the freethreaded CI run#19861
ayshih wants to merge 3 commits into
astropy:mainfrom
ayshih:context_aware_warnings

Conversation

@ayshih
Copy link
Copy Markdown
Contributor

@ayshih ayshih commented Jun 3, 2026

Description

This PR enables context-aware warnings for the free-threaded CI run. #19205 pre-dates Python 3.14.4, which fixed the bad interaction with the Astropy logger. Fixes to tests:

  • Free-threaded Python changes how warnings.catch_warnings(record=True) works, so it is now incompatible with the warnings capturing by the logger, so three tests are changed to rely entirely on pytest.warns() instead.
  • In the SAMP code on Python 3.13+, a SAMPWarning warning gets caught by a try..except and turned into an error (eventually SAMPProxyError). Previously pytest.warns() could actually intercept and catch the SAMPWarning before it was turned into an error, but that is no longer possible with context-aware warnings. The test is changed to simply check for the eventual SAMPProxyError error instead.

Closes #19205

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@Cadair Cadair added the Extra CI Run cron CI as part of PR label Jun 3, 2026
@pllim pllim added this to the v8.1.0 milestone Jun 3, 2026
@ayshih ayshih force-pushed the context_aware_warnings branch from 7fbb614 to 2e8f66c Compare June 4, 2026 18:51
@ayshih ayshih marked this pull request as ready for review June 4, 2026 19:16
@ayshih ayshih requested a review from neutrinoceros as a code owner June 4, 2026 19:16
@ayshih ayshih marked this pull request as draft June 4, 2026 19:17
@ayshih ayshih force-pushed the context_aware_warnings branch from 2e8f66c to d0d034f Compare June 4, 2026 19:27
@ayshih ayshih marked this pull request as ready for review June 4, 2026 19:42
@ayshih ayshih marked this pull request as draft June 4, 2026 19:43
@ayshih ayshih force-pushed the context_aware_warnings branch from d0d034f to a84764f Compare June 4, 2026 19:45
@ayshih ayshih marked this pull request as ready for review June 4, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Extra CI Run cron CI as part of PR testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST: test suite is not robust against context-aware-warnings (Python 3.14)

3 participants