mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Bump pytest-salt-factories to 0.11.x
This commit is contained in:
parent
61877627eb
commit
c06f77dd2b
23 changed files with 44 additions and 51 deletions
|
@ -4,6 +4,6 @@ pytest >= 5.4.2; sys_platform != "win32"
|
|||
# https://github.com/pytest-dev/pytest/issues/6964#issuecomment-632727439
|
||||
pytest >=4.6.9,<4.7; sys_platform == "win32"
|
||||
pytest-salt
|
||||
pytest-salt-factories >= 0.10.7
|
||||
pytest-salt-factories >= 0.11.3
|
||||
pytest-tempdir >= 2019.10.12
|
||||
pytest-helpers-namespace >= 2019.1.8
|
||||
|
|
|
@ -89,7 +89,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -89,7 +89,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -180,7 +180,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -82,7 +82,7 @@ pymysql==0.9.3
|
|||
pyopenssl==19.0.0
|
||||
pyparsing==2.4.5 # via packaging
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==4.6.9 ; sys_platform == "win32"
|
||||
|
|
|
@ -94,7 +94,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -94,7 +94,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -184,7 +184,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -81,7 +81,7 @@ pymysql==0.9.3
|
|||
pyopenssl==19.0.0
|
||||
pyparsing==2.4.5 # via packaging
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==4.6.9 ; sys_platform == "win32"
|
||||
|
|
|
@ -92,7 +92,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -93,7 +93,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -183,7 +183,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -79,7 +79,7 @@ pymysql==0.9.3
|
|||
pyopenssl==19.0.0
|
||||
pyparsing==2.4.5 # via packaging
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==4.6.9 ; sys_platform == "win32"
|
||||
|
|
|
@ -91,7 +91,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -92,7 +92,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -183,7 +183,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -91,7 +91,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -92,7 +92,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -183,7 +183,7 @@ pyopenssl==19.0.0
|
|||
pyparsing==2.4.5 # via junos-eznc, packaging
|
||||
pyserial==3.4 # via junos-eznc, netmiko
|
||||
pytest-helpers-namespace==2019.1.8
|
||||
pytest-salt-factories==0.10.7
|
||||
pytest-salt-factories==0.11.3
|
||||
pytest-salt==2020.1.27
|
||||
pytest-tempdir==2019.10.12
|
||||
pytest==5.4.2 ; sys_platform != "win32"
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
tests.multimaster.conftest
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Multimaster PyTest prep routines
|
||||
"""
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
@ -30,6 +28,7 @@ def salt_mm_master_config(request, salt_factories):
|
|||
config_defaults = yaml.deserialize(rfh.read())
|
||||
|
||||
config_defaults["root_dir"] = root_dir.strpath
|
||||
config_defaults["transport"] = request.config.getoption("--transport")
|
||||
|
||||
config_overrides = {
|
||||
"file_roots": {
|
||||
|
@ -97,6 +96,7 @@ def salt_mm_sub_master_config(request, salt_factories, salt_mm_master):
|
|||
root_dir = salt_factories._get_root_dir_for_daemon("mm-master")
|
||||
|
||||
config_defaults["root_dir"] = root_dir.strpath
|
||||
config_defaults["transport"] = request.config.getoption("--transport")
|
||||
|
||||
config_overrides = {
|
||||
"file_roots": {
|
||||
|
|
|
@ -7,6 +7,7 @@ import copy
|
|||
import errno
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import pprint
|
||||
import shutil
|
||||
import tempfile
|
||||
|
@ -226,7 +227,7 @@ class SSHDMixin(SaltClientMixin, SaltReturnAssertsMixin):
|
|||
cls.sshd_proc = start_daemon(
|
||||
cls.sshd_bin,
|
||||
SshdDaemon,
|
||||
config_dir=cls.sshd_config_dir,
|
||||
config_dir=pathlib.Path(cls.sshd_config_dir),
|
||||
serve_port=cls.sshd_port,
|
||||
)
|
||||
log.info("%s: sshd started", cls.__name__)
|
||||
|
|
|
@ -212,7 +212,7 @@ def salt_master_config(request, salt_factories, salt_syndic_master_config):
|
|||
{"salt/test/reactor": [os.path.join(RUNTIME_VARS.FILES, "reactor-test.sls")]}
|
||||
]
|
||||
|
||||
config_overrides = {"interface": "0.0.0.0"}
|
||||
config_overrides = {}
|
||||
ext_pillar = []
|
||||
if salt.utils.platform.is_windows():
|
||||
ext_pillar.append(
|
||||
|
|
|
@ -1,26 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Tests for the salt fileclient
|
||||
"""
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils.files
|
||||
from salt import fileclient
|
||||
from salt.ext import six
|
||||
from salt.ext.six.moves import range
|
||||
from tests.integration import AdaptedConfigurationTestCaseMixin
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.mixins import (
|
||||
AdaptedConfigurationTestCaseMixin,
|
||||
LoaderModuleMockMixin,
|
||||
)
|
||||
from tests.support.mock import MagicMock, Mock, patch
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
|
@ -39,7 +33,7 @@ class FileclientTestCase(TestCase):
|
|||
|
||||
def _fake_makedir(self, num=errno.EEXIST):
|
||||
def _side_effect(*args, **kwargs):
|
||||
raise OSError(num, "Errno {0}".format(num))
|
||||
raise OSError(num, "Errno {}".format(num))
|
||||
|
||||
return Mock(side_effect=_side_effect)
|
||||
|
||||
|
@ -99,7 +93,7 @@ SUBDIR_FILES = ("foo.txt", "bar.txt", "baz.txt")
|
|||
|
||||
|
||||
def _get_file_roots(fs_root):
|
||||
return dict([(x, [os.path.join(fs_root, x)]) for x in SALTENVS])
|
||||
return {x: [os.path.join(fs_root, x)] for x in SALTENVS}
|
||||
|
||||
|
||||
class FileClientTest(
|
||||
|
@ -201,7 +195,7 @@ class FileclientCacheTest(
|
|||
|
||||
path = os.path.join(saltenv_root, "foo.txt")
|
||||
with salt.utils.files.fopen(path, "w") as fp_:
|
||||
fp_.write("This is a test file in the '{0}' saltenv.\n".format(saltenv))
|
||||
fp_.write("This is a test file in the '{}' saltenv.\n".format(saltenv))
|
||||
|
||||
subdir_abspath = os.path.join(saltenv_root, SUBDIR)
|
||||
os.makedirs(subdir_abspath)
|
||||
|
@ -209,8 +203,8 @@ class FileclientCacheTest(
|
|||
path = os.path.join(subdir_abspath, subdir_file)
|
||||
with salt.utils.files.fopen(path, "w") as fp_:
|
||||
fp_.write(
|
||||
"This is file '{0}' in subdir '{1} from saltenv "
|
||||
"'{2}'".format(subdir_file, SUBDIR, saltenv)
|
||||
"This is file '{}' in subdir '{} from saltenv "
|
||||
"'{}'".format(subdir_file, SUBDIR, saltenv)
|
||||
)
|
||||
|
||||
# Create the CACHE_ROOT
|
||||
|
@ -220,16 +214,14 @@ class FileclientCacheTest(
|
|||
"""
|
||||
Ensure entire directory is cached to correct location
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
|
||||
with patch.dict(fileclient.__opts__, patched_opts):
|
||||
client = fileclient.get_file_client(fileclient.__opts__, pillar=False)
|
||||
for saltenv in SALTENVS:
|
||||
self.assertTrue(
|
||||
client.cache_dir(
|
||||
"salt://{0}".format(SUBDIR), saltenv, cachedir=None
|
||||
)
|
||||
client.cache_dir("salt://{}".format(SUBDIR), saltenv, cachedir=None)
|
||||
)
|
||||
for subdir_file in SUBDIR_FILES:
|
||||
cache_loc = os.path.join(
|
||||
|
@ -259,7 +251,7 @@ class FileclientCacheTest(
|
|||
Ensure entire directory is cached to correct location when an alternate
|
||||
cachedir is specified and that cachedir is an absolute path
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
alt_cachedir = os.path.join(RUNTIME_VARS.TMP, "abs_cachedir")
|
||||
|
||||
|
@ -268,7 +260,7 @@ class FileclientCacheTest(
|
|||
for saltenv in SALTENVS:
|
||||
self.assertTrue(
|
||||
client.cache_dir(
|
||||
"salt://{0}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
)
|
||||
)
|
||||
for subdir_file in SUBDIR_FILES:
|
||||
|
@ -295,7 +287,7 @@ class FileclientCacheTest(
|
|||
Ensure entire directory is cached to correct location when an alternate
|
||||
cachedir is specified and that cachedir is a relative path
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
alt_cachedir = "foo"
|
||||
|
||||
|
@ -304,7 +296,7 @@ class FileclientCacheTest(
|
|||
for saltenv in SALTENVS:
|
||||
self.assertTrue(
|
||||
client.cache_dir(
|
||||
"salt://{0}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
)
|
||||
)
|
||||
for subdir_file in SUBDIR_FILES:
|
||||
|
@ -335,7 +327,7 @@ class FileclientCacheTest(
|
|||
"""
|
||||
Ensure file is cached to correct location
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
|
||||
with patch.dict(fileclient.__opts__, patched_opts):
|
||||
|
@ -365,7 +357,7 @@ class FileclientCacheTest(
|
|||
Ensure file is cached to correct location when an alternate cachedir is
|
||||
specified and that cachedir is an absolute path
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
alt_cachedir = os.path.join(RUNTIME_VARS.TMP, "abs_cachedir")
|
||||
|
||||
|
@ -394,7 +386,7 @@ class FileclientCacheTest(
|
|||
Ensure file is cached to correct location when an alternate cachedir is
|
||||
specified and that cachedir is a relative path
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
alt_cachedir = "foo"
|
||||
|
||||
|
@ -428,7 +420,7 @@ class FileclientCacheTest(
|
|||
"""
|
||||
Tests functionality for cache_dest
|
||||
"""
|
||||
patched_opts = dict((x, y) for x, y in six.iteritems(self.minion_opts))
|
||||
patched_opts = {x: y for x, y in self.minion_opts.items()}
|
||||
patched_opts.update(self.MOCKED_OPTS)
|
||||
|
||||
relpath = "foo.com/bar.txt"
|
||||
|
@ -445,7 +437,7 @@ class FileclientCacheTest(
|
|||
)
|
||||
|
||||
def _check(ret, expected):
|
||||
assert ret == expected, "{0} != {1}".format(ret, expected)
|
||||
assert ret == expected, "{} != {}".format(ret, expected)
|
||||
|
||||
with patch.dict(fileclient.__opts__, patched_opts):
|
||||
client = fileclient.get_file_client(fileclient.__opts__, pillar=False)
|
||||
|
|
Loading…
Add table
Reference in a new issue