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

Fix distutils tests following setuptools 60.0.0 release #1316

Closed
wants to merge 3 commits into from

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Dec 27, 2021

With v60.0.0 setuptools started monkeypatching the distuils module
to use their own vendored version. Longterm any uses of distuils
should be replaced or removed.

pypa/setuptools#2896
https://setuptools.pypa.io/en/latest/history.html#v60-0-0

--
This change isn't ideal as it might hide an error, but for now it will unblock the CI pipeline.
Furthermore, at least for now, the setuptools copy should be identically with the stdlib one.

Closes #1313

References:

With v60.0.0 setuptools started monkeypatching the distuils module
to use their own vendored version. Longterm any uses of distuils
should be replaced or removed.

pypa/setuptools#2896
@cdce8p cdce8p added the task label Dec 27, 2021
@cdce8p cdce8p added this to the 2.9.1 milestone Dec 27, 2021
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to test find_spec in this test, distutils was used because it was supposed to be always present i guess. We might as well use another dependency we'll keep, like wrapt, lazy_object_proxy (or setuptools, but it might become problematic when we adopt pyproject.toml and something else than setuptools or if we dump setuptools.).

@DanielNoord
Copy link
Collaborator

I think changing the package used for this test makes sense!

wrapt is a dependency with more probability to stay
@Pierre-Sassoulas Pierre-Sassoulas changed the title Temporarily disable distutils test Fix distutils tests following setuptools 60.0.0 release Dec 29, 2021
Comment on lines 75 to 78
def test_find_distutils_submodules_in_virtualenv(self) -> None:
found_spec = spec.find_spec(["distutils", "version"])
self.assertEqual(found_spec.location, distutils.version.__file__)
def test_find_wrapt_submodules_in_virtualenv(self) -> None:
found_spec = spec.find_spec(["wrapt", "decorators"])
self.assertEqual(found_spec.location, wrapt.decorators.__file__)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was specifically designed to test the location of distutils. So this change wouldn't fix it

@DanielNoord
Copy link
Collaborator

DanielNoord commented Dec 29, 2021

I retract my earlier statement, see https://github.com/PyCQA/astroid/pull/672/files.

We actually want to test distutils here, the test was added specifically for it.

Edit: Look likes @cdce8p was a little bit quicker than me 😄

@cdce8p
Copy link
Member Author

cdce8p commented Dec 29, 2021

The idea behind this PR was to temporarily disable the test just until we fix / resolve #1103 and #1282. It doesn't look like it's causing any real world issue at the moment, so we might get away with it.

@Pierre-Sassoulas
Copy link
Member

Seeing the issue in pylint-dev/pylint#73 the result could be false positive for distutil in pylint ?

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good temporary solution even if we regress on pylint #73 as distutil is old and deprecated.

@DanielNoord
Copy link
Collaborator

I think I might have found a fix. I'll create a new PR.

@DanielNoord
Copy link
Collaborator

See #1321. I think we can close this in favour of that one, test seem to be passing there 😄

@Pierre-Sassoulas
Copy link
Member

Amazing fix @DanielNoord !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Github Action for the new version of setuptools
3 participants