-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update tmpdir
usage to tmp_path
and enable no:legacypath
#64
Conversation
tmpdir
usage to tmp_path
and enable no:legacypath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but @jhunkeler wrote this so maybe he can confirm.
|
try: | ||
yield tmpdir.strpath | ||
yield str(tmp_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to just yield the tmp_path
instead of its string form?
That is what is done here
in a similar fixture I wrote based on _jail
.
This would allow one to be sure one is pathlib
compatible, though it might break a few things downstream. Though perhaps the breaking is good?
Or one could leave this fixture unchanged and make a properly-named fixtured called tmp_cwd
that can be used that yields a pathlib.Path
object, and can be transitioned to at anytime by any package that uses ci-watson.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the question and comments.
I added the str
to keep this consistent for the downstream (as you mentioned changing it to a Path
might break things).
Given the naming (_jail
) I would have assumed this was not intended for "public" use. So replacing it with a public fixture (or having the downstream libraries implement their own for their needs) seems reasonable.
To use -p no:legacyapth
here (to keep this test suite updated) _jail
would need to be updated (as is done in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this package, this fixture is also used for HSTCAL. So unless you feel like patching up hstcal and acstools test suite, backward compatibility is a must.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not! Let's keep backwards compatibility. 😅
Oops sorry, also have to add this to |
Thanks for your help! CI is now green. I'm not really seeing any numpy usage (grepping finds no imports of numpy) in this package so maybe numpy 2.0 testing isn't needed? That's certainly outside the scope of this PR. |
Does CRDS use numpy/astropy? Line 30 in 2fc02e8
Also, if you want to test against astropy-dev, you should probably also pull in numpy-dev, but you don't have to. Your call. |
Thanks, all! |
Usage of
tmpdir
inci_watson
prevents packages that useci_watson
from using the-p no:legacypath
pytest option to enforcetmp_path
instead oftmpdir
usage.Although
_jail
is clearly marked with a leading underscore it is used in downstream:https://github.com/search?q=repo%3Aspacetelescope%2Fjwst%20_jail&type=code
https://github.com/search?q=repo%3Aspacetelescope%2Fromancal%20_jail&type=code
This PR updates this package to use
tmp_path
instead oftmpdir
and enables the-p no:legacypath
option.The failure of the
slow-devdeps
CI job also occurs on main and appears related to numpy 2.0.