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

Try to use the same version matching python binary #55171

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/integration/modules/test_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,22 @@ def _create_virtualenv(self, path):
if salt.utils.is_windows():
python = os.path.join(sys.real_prefix, os.path.basename(sys.executable))
else:
python = os.path.join(sys.real_prefix, 'bin', os.path.basename(sys.executable))
python_binary_names = [
'python{}.{}'.format(*sys.version_info),
'python{}'.format(*sys.version_info),
'python'
]
for binary_name in python_binary_names:
python = os.path.join(sys.real_prefix, 'bin', binary_name)
if os.path.exists(python):
break
else:
self.fail(
'Couldn\'t find a python binary name under \'{}\' matching: {}'.format(
os.path.join(sys.real_prefix, 'bin'),
python_binary_names
)
)
# We're running off a virtualenv, and we don't want to create a virtualenv off of
# a virtualenv
kwargs = {'python': python}
Expand Down
17 changes: 16 additions & 1 deletion tests/integration/states/test_pip_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,22 @@ def _create_virtualenv(self, path):
if salt.utils.is_windows():
python = os.path.join(sys.real_prefix, os.path.basename(sys.executable))
else:
python = os.path.join(sys.real_prefix, 'bin', os.path.basename(sys.executable))
python_binary_names = [
'python{}.{}'.format(*sys.version_info),
'python{}'.format(*sys.version_info),
'python'
]
for binary_name in python_binary_names:
python = os.path.join(sys.real_prefix, 'bin', binary_name)
if os.path.exists(python):
break
else:
self.fail(
'Couldn\'t find a python binary name under \'{}\' matching: {}'.format(
os.path.join(sys.real_prefix, 'bin'),
python_binary_names
)
)
# We're running off a virtualenv, and we don't want to create a virtualenv off of
# a virtualenv, let's point to the actual python that created the virtualenv
kwargs = {'python': python}
Expand Down