Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test regressions with Python 3.13.0b4 #2478

Closed
mgorny opened this issue Jul 21, 2024 · 5 comments
Closed

Test regressions with Python 3.13.0b4 #2478

mgorny opened this issue Jul 21, 2024 · 5 comments
Assignees
Labels
python 3.13 Upstream Bug 🪲 Bug in a dependency of astroid
Milestone

Comments

@mgorny
Copy link

mgorny commented Jul 21, 2024

Steps to reproduce

  1. tox -e py313

Current behavior

py313: install_deps> python -I -m pip install -r requirements_full.txt
.pkg: install_requires> python -I -m pip install 'setuptools>=64.0' 'wheel>=0.37.1'
.pkg: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py313: install_package_deps> python -I -m pip install 'typing-extensions>=4.0.0; python_version < "3.11"'
py313: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/astroid/.tox/.tmp/package/1/astroid-3.3.0.dev0.tar.gz
py313: commands[0]> pytest --cov
========================================================= test session starts =========================================================
platform linux -- Python 3.13.0b4, pytest-8.3.1, pluggy-1.5.0
cachedir: .tox/py313/.pytest_cache
rootdir: /tmp/astroid
configfile: pyproject.toml
testpaths: tests
plugins: cov-5.0.0
collected 1690 items                                                                                                                  

tests/brain/numpy/test_core_einsumfunc.py ss                                                                                    [  0%]
tests/brain/numpy/test_core_fromnumeric.py s                                                                                    [  0%]
tests/brain/numpy/test_core_function_base.py s                                                                                  [  0%]
tests/brain/numpy/test_core_multiarray.py sssss                                                                                 [  0%]
tests/brain/numpy/test_core_numeric.py sssss                                                                                    [  0%]
tests/brain/numpy/test_core_numerictypes.py sssssss..                                                                           [  1%]
tests/brain/numpy/test_core_umath.py ssssssss                                                                                   [  1%]
tests/brain/numpy/test_ma.py ssss                                                                                               [  2%]
tests/brain/numpy/test_ndarray.py sss                                                                                           [  2%]
tests/brain/numpy/test_random_mtrand.py ss                                                                                      [  2%]
tests/brain/test_argparse.py .                                                                                                  [  2%]
tests/brain/test_attr.py .....                                                                                                  [  2%]
tests/brain/test_brain.py ......s....ss............................................s........................................... [  8%]
...............x...............s......                                                                                          [ 10%]
tests/brain/test_builtin.py ..................                                                                                  [ 12%]
tests/brain/test_ctypes.py ....x........................                                                                        [ 13%]
tests/brain/test_dataclasses.py ..............................................................................x...              [ 18%]
tests/brain/test_dateutil.py .                                                                                                  [ 18%]
tests/brain/test_enum.py .............................                                                                          [ 20%]
tests/brain/test_hashlib.py ...                                                                                                 [ 20%]
tests/brain/test_multiprocessing.py ...                                                                                         [ 20%]
tests/brain/test_named_tuple.py .......................                                                                         [ 22%]
tests/brain/test_nose.py s                                                                                                      [ 22%]
tests/brain/test_pathlib.py ....                                                                                                [ 22%]
tests/brain/test_pytest.py .                                                                                                    [ 22%]
tests/brain/test_qt.py sss                                                                                                      [ 22%]
tests/brain/test_regex.py .X                                                                                                    [ 22%]
tests/brain/test_signal.py ...                                                                                                  [ 22%]
tests/brain/test_six.py .......                                                                                                 [ 23%]
tests/brain/test_ssl.py .                                                                                                       [ 23%]
tests/brain/test_threading.py ....                                                                                              [ 23%]
tests/brain/test_typing.py .                                                                                                    [ 23%]
tests/brain/test_typing_extensions.py .                                                                                         [ 23%]
tests/brain/test_unittest.py .                                                                                                  [ 23%]
tests/test_builder.py .......................................................x..                                                [ 27%]
tests/test_constraint.py ...................................                                                                    [ 29%]
tests/test_decorators.py ...                                                                                                    [ 29%]
tests/test_filter_statements.py .                                                                                               [ 29%]
tests/test_group_exceptions.py ...                                                                                              [ 29%]
tests/test_helpers.py ...............                                                                                           [ 30%]
tests/test_inference.py ............................................................................................x.......... [ 36%]
.x.....x.........................................................x............................................................. [ 44%]
.............................................................................x........xx.....................x...x............. [ 51%]
...................................x........................................                                                    [ 56%]
tests/test_inference_calls.py ........................                                                                          [ 57%]
tests/test_lookup.py .......................................................                                                    [ 60%]
tests/test_manager.py ............................................                                                              [ 63%]
tests/test_modutils.py ...................................................................                                      [ 67%]
tests/test_nodes.py .......F................................................................................................... [ 73%]
.................................................................................                                               [ 78%]
tests/test_nodes_lineno.py ..................F....                                                                              [ 79%]
tests/test_nodes_position.py ...                                                                                                [ 80%]
tests/test_object_model.py x...............x.........s.........                                                                 [ 82%]
tests/test_objects.py ......................                                                                                    [ 83%]
tests/test_protocols.py .....................                                                                                   [ 84%]
tests/test_python3.py ..........................                                                                                [ 86%]
tests/test_raw_building.py .............                                                                                        [ 87%]
tests/test_regrtest.py .............ss............                                                                              [ 88%]
tests/test_scoped_nodes.py .................................................................................................... [ 94%]
...................................................................                                                             [ 98%]
tests/test_stdlib.py ..                                                                                                         [ 98%]
tests/test_transforms.py .........                                                                                              [ 99%]
tests/test_type_params.py .....                                                                                                 [ 99%]
tests/test_utils.py ........                                                                                                    [100%]

============================================================== FAILURES ===============================================================
_____________________________________________________ AsStringTest.test_f_strings _____________________________________________________

self = <tests.test_nodes.AsStringTest testMethod=test_f_strings>

        def test_f_strings(self):
            code = r'''
    a = f"{'a'}"
    b = f'{{b}}'
    c = f""" "{'c'}" """
    d = f'{d!r} {d!s} {d!a}'
    e = f'{e:.3}'
    f = f'{f:{x}.{y}}'
    n = f'\n'
    everything = f""" " \' \r \t \\ {{ }} {'x' + x!r:a} {["'"]!s:{a}}"""
    '''
            ast = abuilder.string_build(code)
>           self.assertEqual(ast.as_string().strip(), code.strip())
E           AssertionError: 'a = [85 chars]\'{e:3}\'\nf = f\'{f:{x}.{y}}\'\nn = f\'\\n\'\[73 chars]}"""' != 'a = [85 chars]\'{e:.3}\'\nf = f\'{f:{x}.{y}}\'\nn = f\'\\n\'[75 chars]}"""'
E             a = f"{'a'}"
E             b = f'{{b}}'
E             c = f""" "{'c'}" """
E             d = f'{d!r} {d!s} {d!a}'
E           - e = f'{e:3}'
E           + e = f'{e:.3}'
E           ?          +
E             f = f'{f:{x}.{y}}'
E             n = f'\n'
E           - everything = f""" " \' \r \t \\ {{ }} {'x' + x!r:} {["'"]!s:{a}}"""
E           + everything = f""" " \' \r \t \\ {{ }} {'x' + x!r:a} {["'"]!s:{a}}"""
E           ?                                                  +

tests/test_nodes.py:275: AssertionError
_____________________________________________ TestLinenoColOffset.test_end_lineno_string ______________________________________________

    @staticmethod
    def test_end_lineno_string() -> None:
        """FormattedValue, JoinedStr."""
        code = textwrap.dedent(
            """
        f"Hello World: {42.1234:02d}"  #@
        f"Hello: {name=}"  #@
        """
        ).strip()
        ast_nodes = builder.extract_node(code)
        assert isinstance(ast_nodes, list) and len(ast_nodes) == 2
    
        s1 = ast_nodes[0]
        assert isinstance(s1, nodes.JoinedStr)
        assert isinstance(s1.values[0], nodes.Const)
        assert (s1.lineno, s1.col_offset) == (1, 0)
        assert (s1.end_lineno, s1.end_col_offset) == (1, 29)
        if PY312_PLUS:
            assert (s1.values[0].lineno, s1.values[0].col_offset) == (1, 2)
            assert (s1.values[0].end_lineno, s1.values[0].end_col_offset) == (1, 15)
        else:
            # Bug in Python 3.11
            # https://github.com/python/cpython/issues/81639
            assert (s1.values[0].lineno, s1.values[0].col_offset) == (1, 0)
            assert (s1.values[0].end_lineno, s1.values[0].end_col_offset) == (1, 29)
    
        s2 = s1.values[1]
        assert isinstance(s2, nodes.FormattedValue)
        if PY312_PLUS:
            assert (s2.lineno, s2.col_offset) == (1, 15)
            assert (s2.end_lineno, s2.end_col_offset) == (1, 28)
        else:
            assert (s2.lineno, s2.col_offset) == (1, 0)
            assert (s2.end_lineno, s2.end_col_offset) == (1, 29)
    
        assert isinstance(s2.value, nodes.Const)  # 42.1234
        assert (s2.value.lineno, s2.value.col_offset) == (1, 16)
        assert (s2.value.end_lineno, s2.value.end_col_offset) == (1, 23)
>       assert isinstance(s2.format_spec, nodes.JoinedStr)  # ':02d'
E       AssertionError: assert False
E        +  where False = isinstance(<Const.str l.1 at 0x7fdf5d9950a0>, <class 'astroid.nodes.node_classes.JoinedStr'>)
E        +    where <Const.str l.1 at 0x7fdf5d9950a0> = <FormattedValue l.1 at 0x7fdf5d9fc870>.format_spec
E        +    and   <class 'astroid.nodes.node_classes.JoinedStr'> = nodes.JoinedStr

tests/test_nodes_lineno.py:955: AssertionError

----------- coverage: platform linux, python 3.13.0-beta-4 -----------
Name                                              Stmts   Miss  Cover
---------------------------------------------------------------------
astroid/__init__.py                                  17      1    94%
astroid/__pkginfo__.py                                2      0   100%
astroid/_ast.py                                      37      0   100%
astroid/_backport_stdlib_names.py                     7      1    86%
astroid/arguments.py                                133      1    99%
astroid/astroid_manager.py                            4      0   100%
astroid/bases.py                                    376     44    88%
astroid/brain/__init__.py                             0      0   100%
astroid/brain/brain_argparse.py                      24      1    96%
astroid/brain/brain_attrs.py                         35      0   100%
astroid/brain/brain_boto3.py                         13      4    69%
astroid/brain/brain_builtin_inference.py            477     39    92%
astroid/brain/brain_collections.py                   30      0   100%
astroid/brain/brain_crypt.py                          7      0   100%
astroid/brain/brain_ctypes.py                        13      0   100%
astroid/brain/brain_curses.py                         7      0   100%
astroid/brain/brain_dataclasses.py                  316     24    92%
astroid/brain/brain_datetime.py                       9      0   100%
astroid/brain/brain_dateutil.py                       8      0   100%
astroid/brain/brain_fstrings.py                      31     19    39%
astroid/brain/brain_functools.py                     80      1    99%
astroid/brain/brain_gi.py                           139    107    23%
astroid/brain/brain_hashlib.py                       18      0   100%
astroid/brain/brain_http.py                          12      0   100%
astroid/brain/brain_hypothesis.py                    16      7    56%
astroid/brain/brain_io.py                            18      0   100%
astroid/brain/brain_mechanize.py                      7      0   100%
astroid/brain/brain_multiprocessing.py               27      2    93%
astroid/brain/brain_namedtuple_enum.py              280     21    92%
astroid/brain/brain_nose.py                          40      2    95%
astroid/brain/brain_numpy_core_einsumfunc.py          8      0   100%
astroid/brain/brain_numpy_core_fromnumeric.py         7      0   100%
astroid/brain/brain_numpy_core_function_base.py      10      0   100%
astroid/brain/brain_numpy_core_multiarray.py         16      0   100%
astroid/brain/brain_numpy_core_numeric.py            15      0   100%
astroid/brain/brain_numpy_core_numerictypes.py       11      1    91%
astroid/brain/brain_numpy_core_umath.py               8      0   100%
astroid/brain/brain_numpy_ma.py                       7      0   100%
astroid/brain/brain_numpy_ndarray.py                 16      4    75%
astroid/brain/brain_numpy_random_mtrand.py            7      0   100%
astroid/brain/brain_numpy_utils.py                   25      3    88%
astroid/brain/brain_pathlib.py                       24      2    92%
astroid/brain/brain_pkg_resources.py                  7      0   100%
astroid/brain/brain_pytest.py                         8      0   100%
astroid/brain/brain_qt.py                            29     10    66%
astroid/brain/brain_random.py                        55      8    85%
astroid/brain/brain_re.py                            22      1    95%
astroid/brain/brain_regex.py                         18      0   100%
astroid/brain/brain_responses.py                      7      0   100%
astroid/brain/brain_scipy_signal.py                   7      0   100%
astroid/brain/brain_signal.py                        23      2    91%
astroid/brain/brain_six.py                           89      9    90%
astroid/brain/brain_sqlalchemy.py                     7      0   100%
astroid/brain/brain_ssl.py                           16      0   100%
astroid/brain/brain_subprocess.py                    25      0   100%
astroid/brain/brain_threading.py                      7      0   100%
astroid/brain/brain_type.py                          18      0   100%
astroid/brain/brain_typing.py                       159     20    87%
astroid/brain/brain_unittest.py                       7      0   100%
astroid/brain/brain_uuid.py                           7      0   100%
astroid/brain/helpers.py                             66      0   100%
astroid/builder.py                                  224     13    94%
astroid/const.py                                     14      0   100%
astroid/constraint.py                                68      1    99%
astroid/context.py                                   78      2    97%
astroid/decorators.py                                94     26    72%
astroid/exceptions.py                               118      3    97%
astroid/filter_statements.py                         91      2    98%
astroid/helpers.py                                  154      8    95%
astroid/inference_tip.py                             45      1    98%
astroid/interpreter/__init__.py                       0      0   100%
astroid/interpreter/_import/__init__.py               0      0   100%
astroid/interpreter/_import/spec.py                 197     11    94%
astroid/interpreter/_import/util.py                  47      2    96%
astroid/interpreter/dunder_lookup.py                 30      0   100%
astroid/interpreter/objectmodel.py                  488     38    92%
astroid/manager.py                                  246     31    87%
astroid/modutils.py                                 282     40    86%
astroid/nodes/__init__.py                             5      0   100%
astroid/nodes/_base_nodes.py                        261     15    94%
astroid/nodes/as_string.py                          374     12    97%
astroid/nodes/const.py                                1      0   100%
astroid/nodes/node_classes.py                      1990    104    95%
astroid/nodes/node_ng.py                            329     24    93%
astroid/nodes/scoped_nodes/__init__.py                4      0   100%
astroid/nodes/scoped_nodes/mixin.py                  60      0   100%
astroid/nodes/scoped_nodes/scoped_nodes.py         1290     97    92%
astroid/nodes/scoped_nodes/utils.py                  17      0   100%
astroid/nodes/utils.py                                6      0   100%
astroid/objects.py                                  159     10    94%
astroid/protocols.py                                421     43    90%
astroid/raw_building.py                             316     29    91%
astroid/rebuilder.py                                502      7    99%
astroid/test_utils.py                                48      8    83%
astroid/transforms.py                                49      0   100%
astroid/typing.py                                    23      0   100%
astroid/util.py                                      77      9    88%
---------------------------------------------------------------------
TOTAL                                             11022    870    92%

======================================================= short test summary info =======================================================
FAILED tests/test_nodes.py::AsStringTest::test_f_strings - AssertionError: 'a = [85 chars]\'{e:3}\'\nf = f\'{f:{x}.{y}}\'\nn = f\'\\n\'\[73 chars]}"""' != 'a = [85 chars]\'{e:.3}\'\nf = f\'...
FAILED tests/test_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_string - AssertionError: assert False
============================ 2 failed, 1621 passed, 50 skipped, 16 xfailed, 1 xpassed in 167.47s (0:02:47) ============================
py313: exit 1 (171.41 seconds) /tmp/astroid> pytest --cov pid=524964
  py313: FAIL code 1 (207.88=setup[36.48]+cmd[171.41] seconds)
  evaluation failed :( (208.13 seconds)

Expected behavior

Tests passing again :-).

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

3.3.0-dev0 (77100a2)

@Pierre-Sassoulas
Copy link
Member

Should be fixed by #2424, if you don't mind checking with bleeding edge astroid.

@Pierre-Sassoulas
Copy link
Member

Didn't see you were already on bleeding edge, my bad.

@mgorny
Copy link
Author

mgorny commented Jul 21, 2024

No problem. I should have made it cleaner that it's a change in Python 3.13.0b4 specifically.

@jacobtylerwalls
Copy link
Member

Fixed upstream in python/cpython#122308

@mgorny
Copy link
Author

mgorny commented Jul 27, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python 3.13 Upstream Bug 🪲 Bug in a dependency of astroid
Projects
None yet
Development

No branches or pull requests

3 participants