Skip to content

Importing astroid issues a DeprecationWarning #681

Closed
@pquentin

Description

@pquentin

Steps to reproduce

Import astroid.

Current behavior

There's a DeprecationWarning:

$ python -W error -c 'import astroid'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "../astroid/__init__.py", line 63, in <module>
    from astroid.nodes import *
  File "../astroid/nodes.py", line 23, in <module>
    from astroid.node_classes import (
  File "../astroid/node_classes.py", line 38, in <module>
    from astroid import bases
  File "../astroid/bases.py", line 33, in <module>
    MANAGER = manager.AstroidManager()
  File "../astroid/util.py", line 26, in <lambda>
    lambda: importlib.import_module("." + module_name, "astroid")
  File ".../importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "../astroid/manager.py", line 24, in <module>
    from astroid.interpreter._import import spec
  File "../astroid/interpreter/_import/spec.py", line 12, in <module>
    import imp
  File ".../imp.py", line 33, in <module>
    DeprecationWarning, stacklevel=2)
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
$ 

We've been using -W error to run the trio test suite for a long time, but this warning only became an issue when migrating trio to pytest 5 which has changes related to warnings.

Expected behavior

No warning:

$ python -W error -c 'import astroid'
$ 

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

2.2.5

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions