mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #45570 from gtmanfred/2017.7.3
Fix tests for 2017.7.3
This commit is contained in:
commit
e72d81ef22
5 changed files with 31 additions and 9 deletions
|
@ -82,7 +82,7 @@ import re
|
|||
import shutil
|
||||
import logging
|
||||
import sys
|
||||
from pkg_resources import parse_version
|
||||
import pkg_resources
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
@ -1287,7 +1287,7 @@ def list_all_versions(pkg,
|
|||
match = re.search(r'\s*Could not find a version.* \(from versions: (.*)\)', line)
|
||||
if match:
|
||||
versions = [v for v in match.group(1).split(', ') if v and excludes.match(v)]
|
||||
versions.sort(key=parse_version)
|
||||
versions.sort(key=pkg_resources.parse_version)
|
||||
break
|
||||
if not versions:
|
||||
return None
|
||||
|
|
|
@ -23,7 +23,7 @@ requisite to a pkg.installed state for the package which provides pip
|
|||
from __future__ import absolute_import
|
||||
import re
|
||||
import logging
|
||||
from pkg_resources import parse_version
|
||||
import pkg_resources
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
@ -266,11 +266,11 @@ def _pep440_version_cmp(pkg1, pkg2, ignore_epoch=False):
|
|||
pkg2 = normalize(pkg2)
|
||||
|
||||
try:
|
||||
if parse_version(pkg1) < parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) < pkg_resources.parse_version(pkg2):
|
||||
return -1
|
||||
if parse_version(pkg1) == parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) == pkg_resources.parse_version(pkg2):
|
||||
return 0
|
||||
if parse_version(pkg1) > parse_version(pkg2):
|
||||
if pkg_resources.parse_version(pkg1) > pkg_resources.parse_version(pkg2):
|
||||
return 1
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
|
|
|
@ -23,7 +23,7 @@ class ServiceModuleTest(ModuleCase):
|
|||
if os_family == 'RedHat':
|
||||
self.service_name = 'crond'
|
||||
elif os_family == 'Arch':
|
||||
self.service_name = 'systemd-journald'
|
||||
self.service_name = 'sshd'
|
||||
cmd_name = 'systemctl'
|
||||
elif os_family == 'MacOS':
|
||||
self.service_name = 'org.ntp.ntpd'
|
||||
|
|
|
@ -4,19 +4,41 @@ Tests man spm
|
|||
'''
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import destructiveTest
|
||||
from tests.support.paths import CODE_DIR
|
||||
|
||||
|
||||
@destructiveTest
|
||||
class SPMManTest(ModuleCase):
|
||||
'''
|
||||
Validate man spm
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
self.tmpdir = tempfile.mktemp()
|
||||
os.mkdir(self.tmpdir)
|
||||
self.run_function('cmd.run', ['{0} {1} install --root={2}'.format(
|
||||
sys.executable,
|
||||
os.path.join(CODE_DIR, 'setup.py'),
|
||||
self.tmpdir
|
||||
)])
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.tmpdir)
|
||||
|
||||
def test_man_spm(self):
|
||||
'''
|
||||
test man spm
|
||||
'''
|
||||
cmd = self.run_function('cmd.run', ['man spm'])
|
||||
manpath = self.run_function('cmd.run', ['find {0} -name spm.1'.format(self.tmpdir)])
|
||||
self.assertIn('/man1/', manpath)
|
||||
cmd = self.run_function('cmd.run', ['man {0}'.format(manpath)])
|
||||
self.assertIn('Salt Package Manager', cmd)
|
||||
self.assertIn('command for managing Salt packages', cmd)
|
||||
|
|
|
@ -31,7 +31,7 @@ class ServiceTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
if os_family == 'RedHat':
|
||||
self.service_name = 'crond'
|
||||
elif os_family == 'Arch':
|
||||
self.service_name = 'systemd-journald'
|
||||
self.service_name = 'sshd'
|
||||
cmd_name = 'systemctl'
|
||||
elif os_family == 'MacOS':
|
||||
self.service_name = 'org.ntp.ntpd'
|
||||
|
|
Loading…
Add table
Reference in a new issue