Repository navigation
Added a minimal job to check that tests pass when existing config/cache folders are present - #19740
Conversation
…ache and .astropy/config folders are present
|
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.
|
| - ubuntu-latest | ||
| - macos-latest |
There was a problem hiding this comment.
I don't expect any difference to show up within UNIX-based systems, but I guess it doesn't hurt to check 2 of them, especially if the job is only temporary.
| - name: Install astropy with minimal test dependencies | ||
| run: python -m pip install -e ".[test]" | ||
| - name: Create empty .astropy cache and config directories | ||
| run: python -c "from pathlib import Path; [(Path.home() / '.astropy' / d).mkdir(parents=True, exist_ok=True) for d in ('cache', 'config')]" |
There was a problem hiding this comment.
is this written in Python for portability (windows...) ?
There was a problem hiding this comment.
cool. Maybe add a comment if you feel like it. Otherwise, LGTM
| with: | ||
| python-version: "3.12" | ||
| - name: Install astropy with minimal test dependencies | ||
| run: python -m pip install -e ".[test]" |
There was a problem hiding this comment.
editable mode shouldn't be needed ?
| run: python -m pip install -e ".[test]" | |
| run: python -m pip install ".[test]" |
| - name: Create empty .astropy cache and config directories | ||
| run: python -c "from pathlib import Path; [(Path.home() / '.astropy' / d).mkdir(parents=True, exist_ok=True) for d in ('cache', 'config')]" | ||
| - name: Run tests | ||
| run: pytest --pyargs astropy |
There was a problem hiding this comment.
instead of using editable mode, set this env var so the current directory isn't included in sys.path
| run: pytest --pyargs astropy | |
| run: pytest --pyargs astropy | |
| env: | |
| PYTHONSAFEPATH: 1 |
|
I only took a quick glance at the failures and I think some (maybe most) of them should simply be fixed by enforcing isolation with |
|
(nothing blocking, just nits) |
The legacy backward-compat fallback in _DirectoryFinder ran unconditionally, so a leftover ~/.astropy/cache or ~/.astropy/config directory would override an explicit set_temp_cache/set_temp_config target or an ASTROPY_CACHE_DIR/ASTROPY_CONFIG_DIR environment variable. Move the fallback into the default resolution branch so it only applies when no override or environment variable is in effect.
With a non-editable install, running pytest --pyargs astropy from the repo root makes pytest collect the source astropy/conftest.py under a module name that resolves to the installed copy, raising ImportPathMismatchError. Run from an empty directory instead, mirroring the tox changedir convention, so only the installed package is used.
|
@neutrinoceros - this actually implements a proper fix for the issue rather than using the fixtures, as I think there was a real bug. Do you want to review again? |
|
Yay and thank you so much for the fix and tests! However, I dunno how I feel about a whole new matrix (3 extra jobs) just for this part. Is there no way we can piggy back this config into existing test matrix? We have so many jobs as it is. |
|
@pllim - I'll double check |
Fold the empty .astropy/cache and .astropy/config check into the existing direct-pytest job in the weekly cron, which avoids adding a separate multi-platform CI job.
|
@pllim - added to weekly cron, I'll let you decide whether it's worth running Extra CI here |
This comment was marked as outdated.
This comment was marked as outdated.
|
devinfra still failed on rerun, so I am running it off |
… existing config/cache folders are present
… existing config/cache folders are present (#19741) Co-authored-by: Thomas Robitaille <[email protected]>
This fails in CI and does pick up the issues discussed offline - I think we should include this in the CI for now at least during all the config/cache refactoring.