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
Fix #2138. #2154
Fix #2138. #2154
Conversation
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.
This is an improvement over hardcoding /global/cfs/cdirs/desi in the unit tests themselves, but I posted one inline comment about a bug, and I don't think this completely addresses the underlying issue from #2138. Will test more after the desi_root
undefined issue is addressed.
[login36 desispec] pytest py/desispec/test/test_photo.py
============================= test session starts ==============================
platform linux -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0
rootdir: /global/common/software/desi/users/sjbailey/desispec
plugins: astropy-header-0.1.2, filter-subpackage-0.1.1, openfiles-0.5.0, doctestplus-0.12.1, arraydiff-0.3, anyio-3.6.2, astropy-0.10.0, asdf-2.14.3, cov-4.0.0, remotedata-0.4.0, hypothesis-6.62.0, mock-3.10.0
collected 0 items / 1 error
==================================== ERRORS ====================================
_______________ ERROR collecting py/desispec/test/test_photo.py ________________
py/desispec/test/test_photo.py:12: in <module>
if 'NERSC_HOST' in os.environ and os.getenv('DESI_SPECTRO_DATA') == os.path.join(desi_root, 'spectro', 'data'):
E NameError: name 'desi_root' is not defined
=========================== short test summary info ============================
ERROR py/desispec/test/test_photo.py - NameError: name 'desi_root' is not defined
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 4.85s ===============================
With the latest commit at
The only new / different assumption I had to make was
Hopefully this is alright @sbailey. |
Thanks. This PR fixes the second problem listed in #2138, i.e. the failure of test_photo.py when run by itself. Good. We still have the problem that some other test is changing DESI_ROOT and not resetting it, thus breaking test_photo.py when all of the tests are run together with a single |
Tentative fix for #2138 but we'll need to confirm if this fixes this part of the issue you identified, @sbailey:
The functions in
desispec.io.photo
as well as thetest_photo
suite relies entirely ondesispec.io.meta.get_desi_root_readonly
doing the right thing, so if another unit test is changing the top-level DESI path, then I'm going to need help tracking down who/what/where.