Skip to content

TST/BUG: improve portability in a doctest - #20373

Merged
pllim merged 1 commit into
astropy:mainfrom
neutrinoceros:units/fixup-test-portability
Sep 11, 2026
Merged

pllim merged 1 commit into
astropy:mainfrom
neutrinoceros:units/fixup-test-portability

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow up to #20273
The test as written now fails on armv7
example logs

Close #20318

AI Disclosure

None

  • I certify that I am human and that I take full responsibility for this pull request including all interactions with reviewers.

Merge method

  • 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.

@neutrinoceros neutrinoceros added this to the v8.1.0 milestone Sep 11, 2026
@neutrinoceros neutrinoceros added testing Bug Affects-dev PRs and issues that do not impact an existing Astropy release no-changelog-entry-needed Extra CI Run cron CI as part of PR labels Sep 11, 2026
@github-actions github-actions Bot added the units label Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

Comment thread astropy/units/quantity.py Outdated
>>> import astropy.units as u
>>> with u.preserve_dtype_by_default():
... q = u.Quantity([1, 2], u.ct)
... q = u.Quantity([1, 2], u.ct, dtype="int64")

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 wonder if it would make more sense to make an explicit int64 array with dtype (before the context) and then pass it to Quantity without the dtype and it would show the dtype really is preserved?

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.

good call

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.

done

@neutrinoceros
neutrinoceros force-pushed the units/fixup-test-portability branch from 6a8f1d5 to bb87139 Compare September 11, 2026 16:32
@neutrinoceros
neutrinoceros marked this pull request as ready for review September 11, 2026 16:32
@pllim

pllim commented Sep 11, 2026

Copy link
Copy Markdown
Member

This is a duplicate of #20318 that approaches the problem in a different way. We need to pick one and close the other. FYI.

@pllim
pllim requested a review from taldcroft September 11, 2026 16:45
@pllim pllim mentioned this pull request Sep 11, 2026
1 task
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Oh, sorry I didn't think it would have a PR already. FWIW I prefer my approach but I wouldn't mind either way.

@pllim

pllim commented Sep 11, 2026

Copy link
Copy Markdown
Member

No worries. I thought it was gonna get merged fast but it didn't and I forgot about it. My opinion is biased so I will let third-party decide.

@astrofrog astrofrog left a comment

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 personally find this one more explicit and shows we really do preserve the exact type

@pllim
pllim merged commit e1107a0 into astropy:main Sep 11, 2026
45 checks passed
@pllim

pllim commented Sep 11, 2026

Copy link
Copy Markdown
Member

Sounds good to me. Thanks, all!

@neutrinoceros
neutrinoceros deleted the units/fixup-test-portability branch September 11, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Bug Extra CI Run cron CI as part of PR no-changelog-entry-needed testing units

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants