-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 test_issue_6833_pip_upgrade_pip test on OS X #36246
Conversation
@@ -130,6 +131,9 @@ def create(path, | |||
if venv_bin is None: | |||
venv_bin = __opts__.get('venv_bin') or __pillar__.get('venv_bin') | |||
|
|||
if not os.path.exists(venv_bin): | |||
venv_bin = '/'.join([os.path.dirname(sys.executable), venv_bin]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify the need for this, please? I'm not sure under what circumstances we would have the path to the Python binary set but then be unable to find virtualenv that, according to this, would be in the same directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Salt is unable to find the virtualenv binary on OSX because we don't use the system installation of Python and instead put our own build of python in /opt/salt... so you have to pass the full path to the virtualenv binary... just like with pip. salt-call wouldn't work, for example, without specifying the full path to the virtualenv binary. If you don't specify one, and virtualenv happens to be installed in the system installation of python, it will grab that one instead. The value of venv_bin
before this was simply virtualenv
with no path. Which it couldn't find on my machine because virtualenv is not installed in the default python installation. I can remove this and we can address the problem at a later date...
@cachedout I removed the virtualenv code. |
@@ -361,7 +364,6 @@ def test_issue_6833_pip_upgrade_pip(self): | |||
# previously installed | |||
ret = self.run_function( | |||
'pip.install', ['pip==6.0'], upgrade=True, | |||
ignore_installed=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terminalmage The ignore_installed
option was creating a corrupted pip environment on OSX. Pip commands would stack trace. Removing this parameter fixed the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And was any consideration given to platforms other than OSX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just don't think removing an argument altogether that has been part of this test for a while already on other platforms, just to get it passing on another, is a good move. Let's work in Slack to figure out what was happening and perhaps change this line to something like ignore_installed=True if grains['os'] not in ('MacOS',) else False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twangboy and I got to the bottom of this earlier today. When this test had failed in the past, the starting pip version has just been updated. But after taking a closer look, I found that the failure was being caused by stale .pyc files left behind. These were left in place by the ignore_installed=True
as it prevents an uninstall from being done on a package if a new version is being installed.
I spoke with @s0undt3ch earlier and he could not recall the reason for using this argument initially. My best guess is that perhaps when the test was first written, pip was not capable of updating itself (i.e. the uninstall which pip performs before it installs the new version could have been breaking the update process). This, however, is only a guess.
TL;DR it's OK to remove the ignore_installed=True
.
The test that runs these states is testing for behavior that was obsoleted by virtualenv 13.0. Ensure that we have older virtualenv available, and then create a venv with that older version. Use the 2nd virtualenv to attempt the "weird" install.
Ensure we have a test venv created using virtualenv < 13.0
What does this PR do?
Fixes a problem with the test_issue_6833_pip_upgrade_pip test failure on OS X. Skips the
test_pip_installed_weird_install
test on OS X... can't duplicate the problem on OS X.What issues does this PR fix or reference?
https://github.com/saltstack/qa/issues/236
Previous Behavior
The
ignore_installed
option was corrupting the pip environment causing the followingpip.list
function to fail.New Behavior
The
ignore_installed
option is not used (nor needed).Tests written?
NA