Closed 2-5 closed 1 year ago
This is now an error with astroid >= 3
========================================================================= short test summary info ==========================================================================
FAILED tests/test_astroid.py::TestAstroid::test_complex_slice_and_parens - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_comprehensions - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture3 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture4 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture7 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture8 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture9 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fstrings - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_multiline - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_simple - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_parens_around_func - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_print_function - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_slices - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_sys_modules - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_trailing_commas - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_tuples - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?Details</summary>
```
python3.10 -m pytest
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.10.13, pytest-7.4.2, pluggy-1.2.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /var/tmp/paludis/build/dev-python-asttokens-2.4.0/work/PYTHON_ABIS/3.10/asttokens-2.4.0
configfile: setup.cfg
plugins: flaky-3.7.0, expect-1.1.0, dependency-0.5.1, benchmark-4.0.0, services-2.2.1, anyio-3.6.2, django-4.5.2, forked-1.6.0, subtests-0.11.0, xdist-3.3.1, pytest_httpserver-1.0.8, cov-4.1.0, requests-mock-1.11.0, flake8-1.1.1, mock-3.11.1, asyncio-0.21.1, mypy-plugins-3.0.0, trio-0.8.0, hypothesis-6.86.2, xprocess-0.23.0, regressions-2.5.0, typeguard-4.1.5, datadir-1.5.0, pytest_param_files-0.6.0, sphinx_pytest-0.2.0, timeout-2.2.0, Faker-19.10.0, pyfakefs-5.3.0
asyncio: mode=strict
collected 116 items
tests/test_astroid.py ..........FF..s.........FF..FFFF.FF....FF.F..FFF. [ 42%]
tests/test_asttokens.py ....... [ 48%]
tests/test_line_numbers.py ... [ 50%]
tests/test_mark_tokens.py ................................................. [ 93%]
tests/test_tokenless.py ... [ 95%]
tests/test_util.py ..... [100%]
================================================================================= FAILURES =================================================================================
________________________________________________________________ TestAstroid.test_complex_slice_and_parens _________________________________________________________________
self =
module 'astroid.nodes' has no attribute '_BaseContainer'
is because _BaseContainer
got renamed, not because of using astroid.node_classes
.
PR welcome to add _BaseContainer
/ BaseContainer
to astroid_compat.py.
After the rename of _BaseContainer
, there's three tests which still fail. One looks like a count of the nodes touched, which has a comment that the exact number isn't important, so that's easy to fix.
The others look like they're a result of a change in behaviour:
____________________ TestAstroid.test_fixture9 ____________________
self = <tests.test_astroid.TestAstroid testMethod=test_fixture9>
> def test_fixture9(self): self.verify_fixture_file('astroid/module2.py')
tests/test_mark_tokens.py:181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mark_tokens.py:140: in verify_fixture_file
tested_nodes = m.verify_all_nodes(self)
tests/tools.py:89: in verify_all_nodes
self.check_get_text_tokenless(node, test_case, text)
tests/tools.py:160: in check_get_text_tokenless
test_case.assertEqual(text, text_tokenless)
E AssertionError: 'class Aaaa(base):' != ' class Aaaa(base):\n """dynamic class"""'
E - class Aaaa(base):
E + class Aaaa(base):
E """dynamic class"""
@alexmojaki what's the expected outcome here -- is this the sort of thing where you'd update the test expectation, or does this imply that code changes are needed to preserve the previous behaviour? (I haven't yet looked much into what the test actually does).
Nevermind, I think I have fixes (somewhat accidentally) from fixing some of the warnings.
Released 2.4.1
asttokens 2.0.8
raises aDeprecationWarning
inastroid-2.12.11
:https://github.com/PyCQA/astroid/blob/7ed8c6db48faaab02eb57c94659aa54e5c9c3aa1/astroid/node_classes.py#L94-L98
By default Python doesn't show deprecation warnings. To see the warning the
PYTHONWARNINGS=default
env variable needs to be set or the above code run withpython -Wd
https://docs.python.org/3/library/warnings.html#updating-code-for-new-versions-of-dependencies