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: version check for standalone python #1350

Merged
merged 4 commits into from
Apr 19, 2024

Conversation

huxuan
Copy link
Member

@huxuan huxuan commented Apr 16, 2024

  • I have added a news fragment under changelog.d/ (if the patch affects the end users)

Summary of changes

Fix #1349

BTW, the changes also include some code refactor for related part.

Test plan

Tested by running

# command(s) to exercise these changes
pipx install --python 3.1 --fetch-missing-python pycowsay

@huxuan huxuan marked this pull request as ready for review April 16, 2024 11:53
@chrysle
Copy link
Contributor

chrysle commented Apr 16, 2024

Thanks for catching this. A test should be useful.

@huxuan
Copy link
Member Author

huxuan commented Apr 16, 2024

Thanks for catching this. A test should be useful.

Thanks for the review. A test cases for the issue is added, PTAL

Actually, I am not sure whether we should add such kind of tests since it is more like a hard-coding.

I also thought to add some positive test cases but found it will make everything a little complicated to ensure the specific python version is not available especially considering tests against all python versions and all platforms. If necessary, I might suggest to do it in a separate pull request.

@huxuan huxuan force-pushed the xuan.hu/fix-interpreter-version-check branch from 2db621b to ed741e6 Compare April 17, 2024 01:00
@huxuan huxuan changed the title fix version check for standalone python fix: version check for standalone python Apr 18, 2024
@chrysle
Copy link
Contributor

chrysle commented Apr 18, 2024

Actually, I am not sure whether we should add such kind of tests since it is more like a hard-coding.

I generally agree that adding tests that ensure certain features work as expected is a better way of coverage. However, this test case ensures an error is raised correctly on a certain occasion, thus I consider it useful.

I also thought to add some positive test cases but found it will make everything a little complicated to ensure the specific python version is not available especially considering tests against all python versions and all platforms.

It sounds reasonable to me to cover that.

@huxuan
Copy link
Member Author

huxuan commented Apr 18, 2024

I also thought to add some positive test cases but found it will make everything a little complicated to ensure the specific python version is not available especially considering tests against all python versions and all platforms.

It sounds reasonable to me to cover that.

OK, I just forgot the usage of monkey mock and learned from other places, will add some more cases later.

@chrysle chrysle merged commit e9d895a into pypa:main Apr 19, 2024
14 checks passed
@chrysle
Copy link
Contributor

chrysle commented Apr 19, 2024

Thanks!

@huxuan huxuan deleted the xuan.hu/fix-interpreter-version-check branch April 19, 2024 15:38
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.

Version check for standalone python is wrong.
2 participants