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

force recreation of venv if it is not sane (#286) #1797

Merged
merged 4 commits into from Jan 9, 2020

Conversation

@finswimmer
Copy link
Member

finswimmer commented Dec 27, 2019

With this PR a virtual environment is recreated if it's not sane, meaning the python and pip executable is not found within the venv path.

I'm not sure how to write a test for it. If it's necessary, please give me a hint :)

Fixes: #286

Pull Request Check List

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

  • Added tests for changed code.
  • Updated documentation for changed code.
Copy link
Member

sdispater left a comment

We might go into a loop here since there is no guarantee that recreating the virtual environment will fix the issue. If we go this route we should at least display a warning that we recreate the environment because it's invalid.

Another approach, or an addition to this PR, could be to check if the environment is valid after creating it and, if it's not, we could warn the user. A lot of cases we had here comes from the fact that Debian-based systems do not include the venv module by default which leads to a broken environment. If it's only pip missing, we could try to install it by using the get-pip.py script.

finswimmer77@gmail.com added 2 commits Jan 3, 2020
@finswimmer finswimmer requested a review from sdispater Jan 3, 2020
@finswimmer

This comment has been minimized.

Copy link
Member Author

finswimmer commented Jan 5, 2020

I've added a more explicit warning.

I also have a variant in preparation where I check the sanity of the venv after creating this. But I have a problem to pass the tests in env/test_use, because the build_venv is mocked and just create a folder without any content. I'm not sure yet, how to fix these tests...

poetry/utils/env.py Outdated Show resolved Hide resolved
Co-Authored-By: Sébastien Eustace <sebastien.eustace@gmail.com>
@finswimmer finswimmer requested a review from sdispater Jan 8, 2020
@sdispater sdispater merged commit cbb1c18 into python-poetry:master Jan 9, 2020
16 checks passed
16 checks passed
Linting
Details
Linux (2.7)
Details
Linux (3.5)
Details
Linux (3.6)
Details
Linux (3.7)
Details
Linux (3.8)
Details
MacOS (2.7)
Details
MacOS (3.5)
Details
MacOS (3.6)
Details
MacOS (3.7)
Details
MacOS (3.8)
Details
Windows (2.7)
Details
Windows (3.5)
Details
Windows (3.6)
Details
Windows (3.7)
Details
Windows (3.8)
Details
@finswimmer finswimmer mentioned this pull request Jan 10, 2020
0 of 2 tasks complete
@StephenBrown2 StephenBrown2 mentioned this pull request Jan 10, 2020
5 of 5 tasks complete
@danyeaw danyeaw mentioned this pull request Jan 14, 2020
3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.