Skip to content

vendoring: remove dependency on setuptools from vendored pytest#15612

Merged
scheibelp merged 1 commit intodevelopfrom
remove-pkg-resources
Mar 23, 2020
Merged

vendoring: remove dependency on setuptools from vendored pytest#15612
scheibelp merged 1 commit intodevelopfrom
remove-pkg-resources

Conversation

@tgamblin
Copy link
Copy Markdown
Member

Closes #15369.
Closes #9034.
Follow-up of #9261.

Previously, spack test would fail within a new spack environment, because it could not import pkg_resources (part of setuptools) Parts of pytest use setuptools, but we do not need them for Spack, so it's an unnecessary dependency.

Patching pytest is nasty but it's a lot simpler than vendoring yet another mess of packages. Also, recent versions of pytest do not depend on setuptools (see pytest-dev/pytest#5063). We're just stuck with an old version of pytest because we still support Python 2.6.

Astute readers may note that jinja2 also uses pkg_resources, but we don't use any parts of it that actually import pkg_resources. So we do not need to remove these imports from jinja2.

  • Remove the parts of pytest that need setuptools

@tgamblin
Copy link
Copy Markdown
Member Author

@adamjstewart: can you try this out and see if it allows you to test within your spack environment successfully?

@scheibelp scheibelp self-assigned this Mar 21, 2020
@tgamblin tgamblin force-pushed the remove-pkg-resources branch from 299d1ba to 71edbca Compare March 21, 2020 00:43
@tgamblin tgamblin marked this pull request as ready for review March 21, 2020 06:02
@tgamblin
Copy link
Copy Markdown
Member Author

I'm able to get tests working in a bare python (no setuptools) environment using this and #15618.

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

This looks like it will work but IMO should be edited for clarity. Right now I think it's not clear from reading the code why turning these functions into noops is "OK" (i.e. why they don't cause the rest of the code to break).

@tgamblin tgamblin force-pushed the remove-pkg-resources branch from 71edbca to 4fccede Compare March 23, 2020 21:28
@tgamblin
Copy link
Copy Markdown
Member Author

@scheibelp: ready for re-review.

@tgamblin tgamblin force-pushed the remove-pkg-resources branch from 4fccede to 3e7c07f Compare March 23, 2020 21:30
@tgamblin
Copy link
Copy Markdown
Member Author

I made some changes based on @scheibelp's comments that simplify this quite a bit.

Previously, `spack test` would fail within a new spack environment,
because it could not import `pkg_resources` (part of `setuptools`) Parts
of `pytest` use `setuptools`, but we do not need them for Spack, so it's
an unnecessary dependency.

- [x] Remove calls to parts of `pytest` that need setuptools
@tgamblin tgamblin force-pushed the remove-pkg-resources branch from 3e7c07f to 441e4ad Compare March 23, 2020 22:08
@tgamblin
Copy link
Copy Markdown
Member Author

@scheibelp: I removed both functions -- I suppose that does make it much less likely someone will reintroduce this bug.

@scheibelp scheibelp merged commit cde4375 into develop Mar 23, 2020
@scheibelp
Copy link
Copy Markdown
Member

Thanks!

@adamjstewart adamjstewart deleted the remove-pkg-resources branch March 24, 2020 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setuptools needs to be vendored

2 participants