I should have been more cautious about merging this. It breaks on Python 3.11 (only, not 3.10 or 3.12) during test collection: ``` ________________________________________________________ ERROR collecting path/__init__.py ________________________________________________________ /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:942: in find self._find(tests, obj, name, module, source_lines, globs, {}) /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:1016: in _find self._find(tests, val, valname, module, source_lines, /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:1048: in _find self._find(tests, val, valname, module, source_lines, /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:1004: in _find test = self._get_test(obj, name, module, globs, source_lines) /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:1072: in _get_test lineno = self._find_lineno(obj, source_lines) /opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py:1121: in _find_lineno obj = inspect.unwrap(obj).__code__ E AttributeError: 'builtin_function_or_method' object has no attribute '__code__' ``` The issue was reported in https://github.com/python/cpython/issues/117692. _Originally posted by @jaraco in https://github.com/jaraco/path/issues/225#issuecomment-2253664856_
Activity
jaraco commentedon Jul 27, 2024
Gemini seems to think I can disable doctest collection by providing a custom
DoctestModuleclass. I'm not confident, but I'll give it a try.jaraco commentedon Jul 27, 2024
Gemini was wrong (big surprise). Adding an additional collector doesn't disable the build-in doctest collector.
Here's the conftest I created that doesn't work:
Disable doctests on Python 3.11.9+ but not 3.12.
Try with Python 3.12 due to jaraco/path#231.
Update CI Python version to 3.12. (#3429)