Skip to content

Issue with custom_exceptions and astropy #965

@astrofrog

Description

@astrofrog

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions