fix utils path and is_windows imports for tests

This commit is contained in:
ch3ll 2019-12-23 11:49:28 -05:00
parent 67e45ecd23
commit be48a6cb46
No known key found for this signature in database
GPG key ID: 1124C6796EBDBD8D
4 changed files with 8 additions and 6 deletions

View file

@ -744,7 +744,7 @@ class TestDaemon(object):
try:
real_prefix = sys.real_prefix
# The above attribute exists, this is a virtualenv
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
virtualenv_binary = os.path.join(real_prefix, 'Scripts', 'virtualenv.exe')
else:
# We need to remove the virtualenv from PATH or we'll get the virtualenv binary
@ -756,7 +756,7 @@ class TestDaemon(object):
if item.startswith(sys.base_prefix):
path_items.remove(item)
os.environ['PATH'] = os.pathsep.join(path_items)
virtualenv_binary = salt.utils.which('virtualenv')
virtualenv_binary = salt.utils.path.which('virtualenv')
if path is not None:
# Restore previous environ PATH
os.environ['PATH'] = path

View file

@ -172,7 +172,7 @@ def get_python_executable():
to create virtualenvs on windows.
'''
try:
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
python_binary = os.path.join(sys.real_prefix, os.path.basename(sys.executable))
else:
python_binary = os.path.join(sys.real_prefix, 'bin', os.path.basename(sys.executable))

View file

@ -57,7 +57,7 @@ class PipModuleTest(ModuleCase):
virtualenv because it will fail otherwise
'''
try:
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
python = os.path.join(sys.real_prefix, os.path.basename(sys.executable))
else:
python_binary_names = [

View file

@ -39,6 +39,8 @@ from tests.integration import (
)
import salt.config
import salt.log.setup as salt_log_setup
import salt.utils.path
import salt.utils.platform
from salt.utils.immutabletypes import freeze
from salt.utils.verify import verify_env
@ -425,7 +427,7 @@ class MultimasterTestDaemon(TestDaemon):
try:
real_prefix = sys.real_prefix
# The above attribute exists, this is a virtualenv
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
virtualenv_binary = os.path.join(real_prefix, 'Scripts', 'virtualenv.exe')
else:
# We need to remove the virtualenv from PATH or we'll get the virtualenv binary
@ -437,7 +439,7 @@ class MultimasterTestDaemon(TestDaemon):
if item.startswith(sys.base_prefix):
path_items.remove(item)
os.environ['PATH'] = os.pathsep.join(path_items)
virtualenv_binary = salt.utils.which('virtualenv')
virtualenv_binary = salt.utils.path.which('virtualenv')
if path is not None:
# Restore previous environ PATH
os.environ['PATH'] = path