Skip to content

TST: simplify jplephem test case for newer versions - #18331

Merged
pllim merged 2 commits into
astropy:mainfrom
neutrinoceros:coordinates/tst/fix-jplephem-test
Jun 24, 2025
Merged

pllim merged 2 commits into
astropy:mainfrom
neutrinoceros:coordinates/tst/fix-jplephem-test

Conversation

@neutrinoceros

Copy link
Copy Markdown
Contributor

Description

This test failed on weekly cron, presumably because jplephem 0.23 just came out (hard to be certain without a changelog)

  • 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

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.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Failure is unrelated. It's still blocking since the failing job is required for merging, but I'll undraft this any way since there's nothing more to be done here.
ref #18333

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I just pushed a temporary patch to pin scipy on windows, working around #18333. Despite the fact that resolving orthogonal issues in a single PR isn't ideal, it's still the easiest (and to me, only) option available to unblock everything since both issues are mutually blocking: we need to fix both to re-enable PR merging.

@pllim

pllim commented Jun 23, 2025

Copy link
Copy Markdown
Member
___________________ test_ephemeris_local_file_not_ephemeris ____________________

    @pytest.mark.skipif(not HAS_JPLEPHEM, reason="requires jplephem")
    def test_ephemeris_local_file_not_ephemeris():
        # NOTE: This test currently leaves the file open (ResourceWarning).
        # To fix this issue, an upstream fix is required in jplephem
        # package.
>       with pytest.warns(ResourceWarning), pytest.raises(ValueError, match="^file starts"):
E       Failed: DID NOT WARN. No warnings of type (<class 'ResourceWarning'>,) were emitted.
E        Emitted warnings: [].

astropy/coordinates/tests/test_solar_system.py:403: Failed

@neutrinoceros
neutrinoceros force-pushed the coordinates/tst/fix-jplephem-test branch from 4c0fe8e to 4567384 Compare June 23, 2025 18:44
@neutrinoceros
neutrinoceros marked this pull request as draft June 23, 2025 18:49
@neutrinoceros
neutrinoceros force-pushed the coordinates/tst/fix-jplephem-test branch from 4567384 to 52150f9 Compare June 23, 2025 19:01
@neutrinoceros
neutrinoceros marked this pull request as ready for review June 23, 2025 19:07

return wrapped
else:
# jplephem<=2.23 leaves the file open (a ResourceWarning is emitted)

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.

Suggested change
# jplephem<=2.23 leaves the file open (a ResourceWarning is emitted)
# jplephem<=2.22 leaves the file open (a ResourceWarning is emitted)

or

Suggested change
# jplephem<=2.23 leaves the file open (a ResourceWarning is emitted)
# jplephem<2.23 leaves the file open (a ResourceWarning is emitted)

filterwarnings = pytest.mark.filterwarnings("ignore", category=ResourceWarning)


@filterwarnings

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.

Suggested change
@filterwarnings
@pytest.mark.filterwarnings("error" if minversion("jplephem", "2.23") else "ignore", category=ResourceWarning)

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.

oh, that's much better, thanks !

@neutrinoceros
neutrinoceros force-pushed the coordinates/tst/fix-jplephem-test branch from 52150f9 to 0c2eaad Compare June 23, 2025 20:05

@eerovaher eerovaher 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 can approve the changes to coordinates. I can't help with Windows-specific problems, but pinning scipy on Windows seems like a sensible temporary solution to unblock CI.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

@pllim, can you weigh in on the second commit ?

@pllim

pllim commented Jun 23, 2025

Copy link
Copy Markdown
Member

It is in my queue but given that I am running the coordination meeting, not sure when I can get to this. Is this urgent?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Kinda, it's about unblocking CI for every other PR

@pllim pllim 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.

Left comments. Thanks!

# To fix this issue, an upstream fix is required in jplephem
# package.
with pytest.warns(ResourceWarning), pytest.raises(ValueError, match="^file starts"):
with pytest.raises(ValueError, match="^file starts"):

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 would have done the version check inside the test function; keep the existing pytest.warns for not minversion("jplephem", "2.23") but nullcontext otherwise.

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.

that is exactly what I did originally. What you're seeing now is after @eerovaher's review

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.

pytest.warns suggests that the ResourceWarning is something that we want to occur, which is not the case. The warning is instead a nuisance caused by a known bug in a dependency that has been finally fixed, and as such should be explicitly ignored with filterwarnings. The fact that pytest.warns also prevents warnings from causing failures in our tests is a side-effect.

Comment thread pyproject.toml
# Recommended run-time dependencies to enable a lot of functionality within Astropy.
recommended = [
"scipy>=1.9.2",
"scipy<1.16 ; platform_system=='Windows'", # temp, https://github.com/astropy/astropy/issues/18333

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.

Can we address this as separate PR? I haven't had a chance to look at the logs yet and maybe we don't need this after all.

@neutrinoceros neutrinoceros Jun 23, 2025 •

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.

unfortunately I don't think we can, unless you're able to override CI requirements, because both issues are separately breaking the Windows job, which is required.

@pllim pllim 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.

To unblock things, let's merge. But I want to revisit the Windows one. Thanks!

@pllim
pllim merged commit 5d0bcab into astropy:main Jun 24, 2025
@lumberbot-app

lumberbot-app Bot commented Jun 24, 2025

Copy link
Copy Markdown

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v7.1.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 5d0bcab5036724a0e7a95df042719aa3e1885017
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #18331: TST: simplify `jplephem` test case for newer versions'
  1. Push to a named branch:
git push YOURFORK v7.1.x:auto-backport-of-pr-18331-on-v7.1.x
  1. Create a PR against branch v7.1.x, I would have named this PR:

"Backport PR #18331 on branch v7.1.x (TST: simplify jplephem test case for newer versions)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@pllim

pllim commented Jun 24, 2025

Copy link
Copy Markdown
Member

@neutrinoceros are you able to do manual backport? Thanks! 🙏

@neutrinoceros
neutrinoceros deleted the coordinates/tst/fix-jplephem-test branch June 24, 2025 06:01
neutrinoceros pushed a commit to neutrinoceros/astropy that referenced this pull request Jun 24, 2025
…test case for newer versions)

TST: simplify `jplephem` test case for newer versions
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

manual backport at #18335

pllim added a commit to neutrinoceros/astropy that referenced this pull request Jun 25, 2025
…test case for newer versions)

TST: simplify `jplephem` test case for newer versions
@pllim

pllim commented Jun 25, 2025

Copy link
Copy Markdown
Member

Thanks!

pllim added a commit that referenced this pull request Jun 26, 2025
Backport PR #18331 on branch v7.1.x (TST: simplify `jplephem` test case for newer versions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants