Skip to content
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

Issue with custom_exceptions and astropy #965

Closed
astrofrog opened this issue Jan 10, 2025 · 2 comments · Fixed by #990
Closed

Issue with custom_exceptions and astropy #965

astrofrog opened this issue Jan 10, 2025 · 2 comments · Fixed by #990

Comments

@astrofrog
Copy link
Contributor

astrofrog commented Jan 10, 2025

The following demonstrates the issue:

python -m venv clean
source clean/bin/activate
pip install solara[pytest] astropy
echo 'import astropy' > test.py
pytest test.py

the output is:

______________________________________________________________________________ ERROR collecting test.py ______________________________________________________________________________
test.py:1: in <module>
    import astropy
clean/lib/python3.11/site-packages/astropy/__init__.py:176: in <module>
    log = _init_log()
clean/lib/python3.11/site-packages/astropy/logger.py:122: in _init_log
    log._set_defaults()
clean/lib/python3.11/site-packages/astropy/logger.py:499: in _set_defaults
    if self.exception_logging_enabled():
clean/lib/python3.11/site-packages/astropy/logger.py:321: in exception_logging_enabled
    return _AstLogIPYExc in get_ipython().custom_exceptions
E   AttributeError: 'NoneType' object has no attribute 'custom_exceptions'
============================================================================== short test summary info ===============================================================================
ERROR test.py - AttributeError: 'NoneType' object has no attribute 'custom_exceptions'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================== 1 error in 0.14s ==================================================================================

This doesn't happen if we don't install solara into the test environment.

@maartenbreddels
Copy link
Contributor

This was merged in #839 and released in (see #839) version 1.43.0

@astrofrog
Copy link
Contributor Author

That's what I thought but now it seems get_ipython is actually returning None instead of FakeIPython hence the above error

maartenbreddels added a commit that referenced this issue Jan 29, 2025
We do this with all the other methods, so it makes sense to do it here
as well. This should fix #965 and is an alternative to
astropy/astropy#17683
maartenbreddels added a commit that referenced this issue Jan 29, 2025
…#990)

We do this with all the other methods, so it makes sense to do it here
as well. This should fix #965 and is an alternative to
astropy/astropy#17683
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants