Use venv instead of virtualenv in test_installation#1664
Merged
Byron merged 1 commit intogitpython-developers:mainfrom Sep 18, 2023
Merged
Use venv instead of virtualenv in test_installation#1664Byron merged 1 commit intogitpython-developers:mainfrom
Byron merged 1 commit intogitpython-developers:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This eliminates the test dependency on
virtualenvby using the standard libraryvenvmodule instead intest_installation.This is independent of which, if either, users use for the environment that the test runner is run in.
sys.executableis the Python interpreter of that environment, but once the test creates the virtual environment, it uses the virtual environment'spythonandpipcommands for everything else. This is really the same exact approach as before, just instead of installingvirtualenvas a dependency of the project, the standard libraryvenvis used.venvis more commonly used and more widely recommended today thanvirtualenv. So while users can use either and they both work well, it makes sense to test with venv instead. It is rare but possible for a Python installation not to have thevenvmodule, if a fully working build is not installed, such as in a Docker container with insufficient packages installed on some operating systems. But this can usually be remedied by installing the appropriate packages, and becausevenvis a standard library module, it is reasonable to rely on its presence. (Furthermore, thevirtualenvcommand as tested was looked up in a$PATHsearch and could just as well have been broken.)