Merge pull request #41293 from terminalmage/py3-tests

Python 3 test fixes + better pip/virtualenv detection.
This commit is contained in:
Nicole Thomas 2017-05-17 09:13:06 -06:00 committed by GitHub
commit c2377cd2d0
3 changed files with 9 additions and 9 deletions

View File

@ -121,7 +121,8 @@ def _get_pip_bin(bin_env):
if not bin_env:
which_result = __salt__['cmd.which_bin'](
['pip{0}.{1}'.format(*sys.version_info[:2]),
'pip', 'pip2', 'pip3', 'pip-python']
'pip{0}'.format(sys.version_info[0]),
'pip', 'pip-python']
)
if salt.utils.is_windows() and six.PY2:
which_result.encode('string-escape')

View File

@ -11,6 +11,7 @@ import glob
import shutil
import logging
import os
import sys
# Import salt libs
import salt.utils
@ -19,13 +20,11 @@ import salt.utils.verify
from salt.exceptions import CommandExecutionError, SaltInvocationError
from salt.ext.six import string_types
KNOWN_BINARY_NAMES = frozenset(
['virtualenv',
'virtualenv2',
'virtualenv-2.6',
'virtualenv-2.7'
]
)
KNOWN_BINARY_NAMES = frozenset([
'virtualenv-{0}.{1}'.format(*sys.version_info[:2]),
'virtualenv{0}'.format(sys.version_info[0]),
'virtualenv',
])
log = logging.getLogger(__name__)

View File

@ -253,6 +253,6 @@ class TestJobs(cptc.BaseRestCherryPyTest):
'X-Auth-Token': self._token(),
})
resp = json.loads(response.body[0])
resp = json.loads(salt.utils.to_str(response.body[0]))
self.assertIn('test.ping', str(resp['return']))
self.assertEqual(response.status, '200 OK')