python-jedi fails to build with Python 3.11.0a2. =================================== FAILURES =================================== _ test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-goto] _ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', full_name = 'os.walk', has_stub = True has_python = True, way = 'direct' kwargs = {'only_stubs': False, 'prefer_stubs': False}, type_ = 'goto' options = {}, environment = <Environment: 3.11.0 in /usr> @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize('way', ['direct', 'indirect']) @pytest.mark.parametrize( 'kwargs', [ dict(only_stubs=False, prefer_stubs=False), dict(only_stubs=False, prefer_stubs=True), dict(only_stubs=True, prefer_stubs=False), ] ) @pytest.mark.parametrize( ('code', 'full_name', 'has_stub', 'has_python', 'options'), [ ['import os; os.walk', 'os.walk', True, True, {}], ['from collections import Counter', 'collections.Counter', True, True, {}], ['from collections', 'collections', True, True, {}], ['from collections import Counter; Counter', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter()', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter.most_common', 'collections.Counter.most_common', True, True, {}], ['from collections import deque', 'collections.deque', True, False, {'goto_has_python': True}], ['from keyword import kwlist; kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from keyword import kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from socket import AF_INET', 'socket.AddressFamily', True, False, {'goto_full_name': 'socket.AF_INET'}], ['from socket import socket', 'socket.socket', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub_folder.python_only', 'with_stub_folder.python_only', False, True, {}], ['import stub_only', 'stub_only', True, False, {}], ]) def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way, kwargs, type_, options, environment): if type_ == 'infer' and full_name == 'typing.Sequence' and environment.version_info >= (3, 7): # In Python 3.7+ there's not really a sequence definition, there's just # a name that leads nowhere. has_python = False project = Project(os.path.join(root_dir, 'test', 'completion', 'stub_folder')) s = Script(code, project=project) prefer_stubs = kwargs['prefer_stubs'] only_stubs = kwargs['only_stubs'] if type_ == 'goto': full_name = options.get('goto_full_name', full_name) has_python = options.get('goto_has_python', has_python) if way == 'direct': if type_ == 'goto': defs = s.goto(follow_imports=True, **kwargs) else: defs = s.infer(**kwargs) else: goto_defs = s.goto( # Prefering stubs when we want to go to python and vice versa prefer_stubs=not (prefer_stubs or only_stubs), follow_imports=True, ) if type_ == 'goto': defs = [d for goto_def in goto_defs for d in goto_def.goto(**kwargs)] else: defs = [d for goto_def in goto_defs for d in goto_def.infer(**kwargs)] if not has_stub and only_stubs: assert not defs else: assert defs for d in defs: if prefer_stubs and has_stub: assert d.is_stub() elif only_stubs: assert d.is_stub() else: > assert has_python == (not d.is_stub()) E AssertionError: assert True == not True E + where True = <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>>() E + where <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>> = <Name full_name='os.walk', description='def walk'>.is_stub test/test_inference/test_gradual/test_stubs.py:87: AssertionError _ test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-infer] _ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', full_name = 'os.walk', has_stub = True has_python = True, way = 'direct' kwargs = {'only_stubs': False, 'prefer_stubs': False}, type_ = 'infer' options = {}, environment = <Environment: 3.11.0 in /usr> @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize('way', ['direct', 'indirect']) @pytest.mark.parametrize( 'kwargs', [ dict(only_stubs=False, prefer_stubs=False), dict(only_stubs=False, prefer_stubs=True), dict(only_stubs=True, prefer_stubs=False), ] ) @pytest.mark.parametrize( ('code', 'full_name', 'has_stub', 'has_python', 'options'), [ ['import os; os.walk', 'os.walk', True, True, {}], ['from collections import Counter', 'collections.Counter', True, True, {}], ['from collections', 'collections', True, True, {}], ['from collections import Counter; Counter', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter()', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter.most_common', 'collections.Counter.most_common', True, True, {}], ['from collections import deque', 'collections.deque', True, False, {'goto_has_python': True}], ['from keyword import kwlist; kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from keyword import kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from socket import AF_INET', 'socket.AddressFamily', True, False, {'goto_full_name': 'socket.AF_INET'}], ['from socket import socket', 'socket.socket', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub_folder.python_only', 'with_stub_folder.python_only', False, True, {}], ['import stub_only', 'stub_only', True, False, {}], ]) def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way, kwargs, type_, options, environment): if type_ == 'infer' and full_name == 'typing.Sequence' and environment.version_info >= (3, 7): # In Python 3.7+ there's not really a sequence definition, there's just # a name that leads nowhere. has_python = False project = Project(os.path.join(root_dir, 'test', 'completion', 'stub_folder')) s = Script(code, project=project) prefer_stubs = kwargs['prefer_stubs'] only_stubs = kwargs['only_stubs'] if type_ == 'goto': full_name = options.get('goto_full_name', full_name) has_python = options.get('goto_has_python', has_python) if way == 'direct': if type_ == 'goto': defs = s.goto(follow_imports=True, **kwargs) else: defs = s.infer(**kwargs) else: goto_defs = s.goto( # Prefering stubs when we want to go to python and vice versa prefer_stubs=not (prefer_stubs or only_stubs), follow_imports=True, ) if type_ == 'goto': defs = [d for goto_def in goto_defs for d in goto_def.goto(**kwargs)] else: defs = [d for goto_def in goto_defs for d in goto_def.infer(**kwargs)] if not has_stub and only_stubs: assert not defs else: assert defs for d in defs: if prefer_stubs and has_stub: assert d.is_stub() elif only_stubs: assert d.is_stub() else: > assert has_python == (not d.is_stub()) E AssertionError: assert True == not True E + where True = <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>>() E + where <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>> = <Name full_name='os.walk', description='def walk'>.is_stub test/test_inference/test_gradual/test_stubs.py:87: AssertionError _ test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-goto] _ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', full_name = 'os.walk', has_stub = True has_python = True, way = 'indirect' kwargs = {'only_stubs': False, 'prefer_stubs': False}, type_ = 'goto' options = {}, environment = <Environment: 3.11.0 in /usr> @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize('way', ['direct', 'indirect']) @pytest.mark.parametrize( 'kwargs', [ dict(only_stubs=False, prefer_stubs=False), dict(only_stubs=False, prefer_stubs=True), dict(only_stubs=True, prefer_stubs=False), ] ) @pytest.mark.parametrize( ('code', 'full_name', 'has_stub', 'has_python', 'options'), [ ['import os; os.walk', 'os.walk', True, True, {}], ['from collections import Counter', 'collections.Counter', True, True, {}], ['from collections', 'collections', True, True, {}], ['from collections import Counter; Counter', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter()', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter.most_common', 'collections.Counter.most_common', True, True, {}], ['from collections import deque', 'collections.deque', True, False, {'goto_has_python': True}], ['from keyword import kwlist; kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from keyword import kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from socket import AF_INET', 'socket.AddressFamily', True, False, {'goto_full_name': 'socket.AF_INET'}], ['from socket import socket', 'socket.socket', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub_folder.python_only', 'with_stub_folder.python_only', False, True, {}], ['import stub_only', 'stub_only', True, False, {}], ]) def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way, kwargs, type_, options, environment): if type_ == 'infer' and full_name == 'typing.Sequence' and environment.version_info >= (3, 7): # In Python 3.7+ there's not really a sequence definition, there's just # a name that leads nowhere. has_python = False project = Project(os.path.join(root_dir, 'test', 'completion', 'stub_folder')) s = Script(code, project=project) prefer_stubs = kwargs['prefer_stubs'] only_stubs = kwargs['only_stubs'] if type_ == 'goto': full_name = options.get('goto_full_name', full_name) has_python = options.get('goto_has_python', has_python) if way == 'direct': if type_ == 'goto': defs = s.goto(follow_imports=True, **kwargs) else: defs = s.infer(**kwargs) else: goto_defs = s.goto( # Prefering stubs when we want to go to python and vice versa prefer_stubs=not (prefer_stubs or only_stubs), follow_imports=True, ) if type_ == 'goto': defs = [d for goto_def in goto_defs for d in goto_def.goto(**kwargs)] else: defs = [d for goto_def in goto_defs for d in goto_def.infer(**kwargs)] if not has_stub and only_stubs: assert not defs else: assert defs for d in defs: if prefer_stubs and has_stub: assert d.is_stub() elif only_stubs: assert d.is_stub() else: > assert has_python == (not d.is_stub()) E AssertionError: assert True == not True E + where True = <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>>() E + where <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>> = <Name full_name='os.walk', description='def walk'>.is_stub test/test_inference/test_gradual/test_stubs.py:87: AssertionError _ test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-infer] _ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', full_name = 'os.walk', has_stub = True has_python = True, way = 'indirect' kwargs = {'only_stubs': False, 'prefer_stubs': False}, type_ = 'infer' options = {}, environment = <Environment: 3.11.0 in /usr> @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize('way', ['direct', 'indirect']) @pytest.mark.parametrize( 'kwargs', [ dict(only_stubs=False, prefer_stubs=False), dict(only_stubs=False, prefer_stubs=True), dict(only_stubs=True, prefer_stubs=False), ] ) @pytest.mark.parametrize( ('code', 'full_name', 'has_stub', 'has_python', 'options'), [ ['import os; os.walk', 'os.walk', True, True, {}], ['from collections import Counter', 'collections.Counter', True, True, {}], ['from collections', 'collections', True, True, {}], ['from collections import Counter; Counter', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter()', 'collections.Counter', True, True, {}], ['from collections import Counter; Counter.most_common', 'collections.Counter.most_common', True, True, {}], ['from collections import deque', 'collections.deque', True, False, {'goto_has_python': True}], ['from keyword import kwlist; kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from keyword import kwlist', 'typing.Sequence', True, True, {'goto_full_name': 'keyword.kwlist'}], ['from socket import AF_INET', 'socket.AddressFamily', True, False, {'goto_full_name': 'socket.AF_INET'}], ['from socket import socket', 'socket.socket', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub', 'with_stub', True, True, {}], ['import with_stub_folder.python_only', 'with_stub_folder.python_only', False, True, {}], ['import stub_only', 'stub_only', True, False, {}], ]) def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way, kwargs, type_, options, environment): if type_ == 'infer' and full_name == 'typing.Sequence' and environment.version_info >= (3, 7): # In Python 3.7+ there's not really a sequence definition, there's just # a name that leads nowhere. has_python = False project = Project(os.path.join(root_dir, 'test', 'completion', 'stub_folder')) s = Script(code, project=project) prefer_stubs = kwargs['prefer_stubs'] only_stubs = kwargs['only_stubs'] if type_ == 'goto': full_name = options.get('goto_full_name', full_name) has_python = options.get('goto_has_python', has_python) if way == 'direct': if type_ == 'goto': defs = s.goto(follow_imports=True, **kwargs) else: defs = s.infer(**kwargs) else: goto_defs = s.goto( # Prefering stubs when we want to go to python and vice versa prefer_stubs=not (prefer_stubs or only_stubs), follow_imports=True, ) if type_ == 'goto': defs = [d for goto_def in goto_defs for d in goto_def.goto(**kwargs)] else: defs = [d for goto_def in goto_defs for d in goto_def.infer(**kwargs)] if not has_stub and only_stubs: assert not defs else: assert defs for d in defs: if prefer_stubs and has_stub: assert d.is_stub() elif only_stubs: assert d.is_stub() else: > assert has_python == (not d.is_stub()) E AssertionError: assert True == not True E + where True = <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>>() E + where <bound method BaseName.is_stub of <Name full_name='os.walk', description='def walk'>> = <Name full_name='os.walk', description='def walk'>.is_stub test/test_inference/test_gradual/test_stubs.py:87: AssertionError _______________________________ test_goto_stubs ________________________________ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) def test_goto_stubs(Script): s = Script('import os; os') os_module, = s.infer() assert os_module.full_name == 'os' > assert os_module.is_stub() is False E AssertionError: assert True is False E + where True = <bound method BaseName.is_stub of <Name full_name='os', description='module os'>>() E + where <bound method BaseName.is_stub of <Name full_name='os', description='module os'>> = <Name full_name='os', description='module os'>.is_stub test/test_inference/test_gradual/test_typeshed.py:162: AssertionError ______________ test_goto_stubs_on_itself[import os; os.walk-goto] ______________ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', type_ = 'goto' @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize( 'code', [ 'import os; os.walk', 'from collections import Counter; Counter', 'from collections import Counter; Counter()', 'from collections import Counter; Counter.most_common', 'from collections import Counter; Counter().most_common', ]) def test_goto_stubs_on_itself(Script, code, type_): """ If goto_stubs is used on an identifier in e.g. the stdlib, we should goto the stub of it. """ s = Script(code) if type_ == 'infer': def_, = s.infer() else: def_, = s.goto(follow_imports=True) stub, = def_.goto(only_stubs=True) script_on_source = Script(path=def_.module_path) if type_ == 'infer': definition, = script_on_source.infer(def_.line, def_.column) else: definition, = script_on_source.goto(def_.line, def_.column) same_stub, = definition.goto(only_stubs=True) _assert_is_same(same_stub, stub) _assert_is_same(definition, def_) > assert same_stub.module_path != def_.module_path E AssertionError: assert PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') != PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') E + where PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') = <Name full_name='os.walk', description='def walk'>.module_path E + and PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') = <Name full_name='os.walk', description='def walk'>.module_path test/test_inference/test_gradual/test_typeshed.py:205: AssertionError _____________ test_goto_stubs_on_itself[import os; os.walk-infer] ______________ Script = functools.partial(<class 'jedi.api.Script'>, environment=<Environment: 3.11.0 in /usr>) code = 'import os; os.walk', type_ = 'infer' @pytest.mark.parametrize('type_', ['goto', 'infer']) @pytest.mark.parametrize( 'code', [ 'import os; os.walk', 'from collections import Counter; Counter', 'from collections import Counter; Counter()', 'from collections import Counter; Counter.most_common', 'from collections import Counter; Counter().most_common', ]) def test_goto_stubs_on_itself(Script, code, type_): """ If goto_stubs is used on an identifier in e.g. the stdlib, we should goto the stub of it. """ s = Script(code) if type_ == 'infer': def_, = s.infer() else: def_, = s.goto(follow_imports=True) stub, = def_.goto(only_stubs=True) script_on_source = Script(path=def_.module_path) if type_ == 'infer': definition, = script_on_source.infer(def_.line, def_.column) else: definition, = script_on_source.goto(def_.line, def_.column) same_stub, = definition.goto(only_stubs=True) _assert_is_same(same_stub, stub) _assert_is_same(definition, def_) > assert same_stub.module_path != def_.module_path E AssertionError: assert PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') != PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') E + where PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') = <Name full_name='os.walk', description='def walk'>.module_path E + and PosixPath('/builddir/build/BUILD/jedi-0.18.0/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi') = <Name full_name='os.walk', description='def walk'>.module_path test/test_inference/test_gradual/test_typeshed.py:205: AssertionError =========================== short test summary info ============================ FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-goto] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-infer] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-goto] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-infer] FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs - A... FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs_on_itself[import os; os.walk-goto] FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs_on_itself[import os; os.walk-infer] ==== 7 failed, 1392 passed, 21 skipped, 84 deselected, 1 xfailed in 31.36s ===== For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/02940052-python-jedi/ For all our attempts to build python-jedi with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-jedi/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/ Let us know here if you have any questions. Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle. Changing version to 36.
There seem to be more test failures now. From https://koji.fedoraproject.org/koji/packageinfo?packageID=15994 FAILED test/test_utils.py::TestSetupReadline::test_import - AssertionError: a... FAILED test/test_api/test_classes.py::test_import - AssertionError: assert 'p... FAILED test/test_api/test_environment.py::test_find_system_environments - ass... FAILED test/test_api/test_interpreter.py::test_string_annotation[annotations10-result10-] FAILED test/test_api/test_interpreter.py::test_string_annotation[annotations13-result13-] FAILED test/test_inference/test_imports.py::test_find_module_not_package - At... FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-goto] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-direct-infer] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-goto] FAILED test/test_inference/test_gradual/test_stubs.py::test_infer_and_goto[import os; os.walk-os.walk-True-True-options0-kwargs0-indirect-infer] FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs - A... FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs_on_itself[import os; os.walk-goto] FAILED test/test_inference/test_gradual/test_typeshed.py::test_goto_stubs_on_itself[import os; os.walk-infer] = 13 failed, 1507 passed, 22 skipped, 1 deselected, 5 xfailed, 9 warnings in 48.49s = jedi has old bytecode (see bz2107826), so this no longer has a low priority
https://src.fedoraproject.org/rpms/python-jedi/pull-request/9
https://bodhi.fedoraproject.org/updates/FEDORA-2022-c532aa7486