twisted / pydoctor

This is pydoctor, an API documentation generator that works by static analysis.
https://pydoctor.readthedocs.io
Other
179 stars 48 forks source link

ERROR collecting pydoctor/test/test_attrs.py with Python-3.12 #749

Closed sagitter closed 8 months ago

sagitter commented 8 months ago

Hi all.

pydoctor/test/test_attrs.py is failing with Python-3.12.0 when i test pydoctor-23.9.1 in Fedora:

+ PYTHONDONTWRITEBYTECODE=1
+ PYTEST_ADDOPTS=' --ignore=/builddir/build/BUILD/pydoctor-23.9.1/.pyproject-builddir'
+ PYTEST_XDIST_AUTO_NUM_WORKERS=6
+ /usr/bin/pytest -v -k 'not test_cyclic_imports_base_classes and not test_expressions_parens'
============================= test session starts ==============================
platform linux -- Python 3.12.0, pytest-7.4.2, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/builddir/build/BUILD/pydoctor-23.9.1/.hypothesis/examples')
rootdir: /builddir/build/BUILD/pydoctor-23.9.1
configfile: setup.cfg
testpaths: pydoctor/test
plugins: hypothesis-6.82.0
collecting ... collected 521 items / 2 errors / 2 deselected / 519 selected
==================================== ERRORS ====================================
______________ ERROR collecting pydoctor/test/test_astbuilder.py _______________
/usr/lib/python3.12/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.12/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.12/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.12/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.12/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.12/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.12/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.12/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1381: in _gcd_import
    ???
<frozen importlib._bootstrap>:1354: in _find_and_load
    ???
<frozen importlib._bootstrap>:1304: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1381: in _gcd_import
    ???
<frozen importlib._bootstrap>:1354: in _find_and_load
    ???
<frozen importlib._bootstrap>:1325: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:929: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:994: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
pydoctor/test/__init__.py:12: in <module>
    from pydoctor import epydoc2stan, model
pydoctor/epydoc2stan.py:16: in <module>
    from pydoctor import model, linker, node2stan
pydoctor/model.py:29: in <module>
    from pydoctor import factory, qnmatch, utils, linker, astutils, mro
pydoctor/astutils.py:214: in <module>
    class _AnnotationStringParser(ast.NodeTransformer):
pydoctor/astutils.py:262: in _AnnotationStringParser
    def visit_Str(self, node: ast.Str) -> ast.expr:
/usr/lib64/python3.12/ast.py:1797: in __getattr__
    warnings._deprecated(
/usr/lib64/python3.12/warnings.py:529: in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
E   DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
_________________ ERROR collecting pydoctor/test/test_attrs.py _________________
/usr/lib/python3.12/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.12/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.12/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.12/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.12/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.12/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.12/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.12/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1381: in _gcd_import
    ???
<frozen importlib._bootstrap>:1354: in _find_and_load
    ???
<frozen importlib._bootstrap>:1304: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1381: in _gcd_import
    ???
<frozen importlib._bootstrap>:1354: in _find_and_load
    ???
<frozen importlib._bootstrap>:1325: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:929: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:994: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
pydoctor/test/__init__.py:12: in <module>
    from pydoctor import epydoc2stan, model
pydoctor/epydoc2stan.py:22: in <module>
    from pydoctor.epydoc.markup._pyval_repr import colorize_pyval, colorize_inline_pyval
pydoctor/epydoc/markup/_pyval_repr.py:46: in <module>
    import astor.op_util
/usr/lib/python3.12/site-packages/astor/__init__.py:15: in <module>
    from .code_gen import SourceGenerator, to_source  # NOQA
/usr/lib/python3.12/site-packages/astor/code_gen.py:25: in <module>
    from .op_util import get_op_symbol, get_op_precedence, Precedence
/usr/lib/python3.12/site-packages/astor/op_util.py:92: in <module>
    precedence_data = dict((getattr(ast, x, None), z) for x, y, z in op_data)
/usr/lib/python3.12/site-packages/astor/op_util.py:92: in <genexpr>
    precedence_data = dict((getattr(ast, x, None), z) for x, y, z in op_data)
/usr/lib64/python3.12/ast.py:1797: in __getattr__
    warnings._deprecated(
/usr/lib64/python3.12/warnings.py:529: in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
E   DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
=========================== short test summary info ============================
ERROR pydoctor/test/test_astbuilder.py - DeprecationWarning: ast.Str is depre...
ERROR pydoctor/test/test_attrs.py - DeprecationWarning: ast.Num is deprecated...
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
======================= 2 deselected, 2 errors in 3.08s ========================
tristanlatr commented 8 months ago

Pydoctor 23.9.x doesn’t support python 3.12, this will come with the next version

tristanlatr commented 8 months ago

Anyway this warning comes from astor, so we can’t do anything about it.

tristanlatr commented 3 months ago

Actually, this warning has been fixed in the latest version.