| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good to me!
Sorry, something went wrong.
Co-authored-by: Greg Lucas <greg.m.lucas@gmail.com>
| Back | FazBrowse Home | New Git URL |
PR summary
On macOS, trying to run pytest with cairocffi installed but no cairo produces an OSError from dlopen():
… ERROR collecting lib/matplotlib/tests/test_backends_rendering.py … lib/matplotlib/backends/backend_cairo.py:18: in <module> import cairo E ModuleNotFoundError: No module named 'cairo' During handling of the above exception, another exception occurred: lib/matplotlib/tests/test_backends_rendering.py:21: in <module> from matplotlib.backends.backend_cairo import RendererCairo, cairo lib/matplotlib/backends/backend_cairo.py:24: in <module> import cairocffi as cairo .venv/lib/python3.14/site-packages/cairocffi/__init__.py:60: in <module> cairo = dlopen( .venv/lib/python3.14/site-packages/cairocffi/__init__.py:57: in dlopen raise OSError(error_message) # pragma: no cover ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E OSError: no library called "cairo-2" was found E no library called "cairo" was found E no library called "libcairo-2" was found E cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 0x0002): tried: 'libcairo.so.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache), 'libcairo.so.2' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'Originally, I added OSError to test_backends_rendering.py to fix this.
However, I decided that it would be better to catch the OSError in backend_cairo.py and then re-throw as an ImportError with a better error message.
AI Disclosure
None used.
PR quality check