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

Use installer instead of setuptools in test suite #11291

Merged
merged 1 commit into from
Jul 23, 2022

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Jul 23, 2022

In the test suite, instead of using a private setuptools api to install common wheels in "editable" mode, use installer together with a .pth.

closes #11256

tests/conftest.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
"platlib": str(lib_install_dir),
"scripts": str(bin_install_dir),
},
interpreter=sys.executable,
Copy link
Member

@pradyunsg pradyunsg Jul 23, 2022

Choose a reason for hiding this comment

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

This would mean that the executables/scripts from these installs will run with the same environment as the test runner (i.e. pytest), which is likely not what we want.

This should really be using the Python executable from the virtualenv. I think the right thing to do here would be to change up the virtualenv fixture, with the object coming from that getting a new .install_from_wheel(path) method.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think these scripts are never used. I'll remove the bin dir and see if the tests pass.
Then we can do a refactoring in followup, after #11288.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, let's do that!

I might end up picking up the refactoring, as part of https://github.com/pradyunsg/pip/tree/improve-test-isolation. :)

@sbidoul sbidoul force-pushed the testsuite-with-installer-sbi branch 3 times, most recently from 338b502 to 8520de7 Compare July 23, 2022 14:04
@sbidoul sbidoul marked this pull request as ready for review July 23, 2022 14:05
@sbidoul
Copy link
Member Author

sbidoul commented Jul 23, 2022

Alright, tests pass, at least on linux. I pushed some minor tweaks.
If green, we can merge this and open another one that removes SETUPTOOLS_USE_DISTUTILS from the nox session and see what happens.

Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

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

LGTM, assuming CI is happy and a typo is fixed. I'll green tick, trusting that @sbidoul will fix the typo before merging. :)

news/11256.process.rst Outdated Show resolved Hide resolved
Instead of using a private setuptools api to
install common wheels in "editable" mode,
use 'installer' together with a .pth.
@sbidoul sbidoul force-pushed the testsuite-with-installer-sbi branch from 8520de7 to 3f5436c Compare July 23, 2022 14:29
@@ -109,7 +109,7 @@ def test_local_columns_flag(simple_script: PipTestEnvironment) -> None:
assert "Package" in result.stdout
assert "Version" in result.stdout
assert "simple (1.0)" not in result.stdout
assert "simple 1.0" in result.stdout, str(result)
assert "simple 1.0" in result.stdout, str(result)
Copy link
Member Author

Choose a reason for hiding this comment

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

This test changes because pip list --local does not show coverage and setuptools while it did before.
Therefore the column is smaller.

I think this is correct because coverage and setuptools are outside of the virtualenv, according to our implementation of BaseDistribution.local.

@sbidoul sbidoul added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jul 23, 2022
@sbidoul sbidoul merged commit 9351efd into pypa:main Jul 23, 2022
@sbidoul sbidoul deleted the testsuite-with-installer-sbi branch July 23, 2022 14:38
@sbidoul sbidoul added this to the 22.2.1 milestone Jul 23, 2022
@sbidoul sbidoul added the type: maintenance Related to Development and Maintenance Processes label Jul 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes) type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: dist must be a Distribution instance
2 participants