Skip to content

Fix distutils tests following setuptools 60.0.0 release #1316

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/unittest_modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE

"""
unit tests for module modutils (module manipulation utilities)
Unit tests for module modutils (module manipulation utilities)
"""
import distutils.version
import email
Expand All @@ -33,6 +33,8 @@
from xml import etree
from xml.etree import ElementTree

import pytest

import astroid
from astroid import modutils
from astroid.interpreter._import import spec
Expand Down Expand Up @@ -72,6 +74,13 @@ def test_find_egg_module(self) -> None:
["data", "MyPyPa-0.1.0-py2.5.egg", self.package],
)

# TODO: Fix when removing distutils dependency
# https://github.com/pypa/setuptools/pull/2896
@pytest.mark.xfail(
sys.version_info > (3, 7),
sys.version_info < (3, 11),
reason="setuptools v60.0.0 starts using local copy of distutils",
)
def test_find_distutils_submodules_in_virtualenv(self) -> None:
found_spec = spec.find_spec(["distutils", "version"])
self.assertEqual(found_spec.location, distutils.version.__file__)
Expand Down