diff --git a/salt/key.py b/salt/key.py index 84d28d1335f..9a09dec4739 100644 --- a/salt/key.py +++ b/salt/key.py @@ -3,7 +3,6 @@ The Salt Key backend API and interface used by the CLI. The Key class can be used to manage salt keys directly without interfacing with the CLI. """ - import fnmatch import itertools import logging @@ -656,7 +655,8 @@ class Key: continue try: shutil.move( - key_path, os.path.join(self.opts["pki_dir"], self.ACC, key), + key_path, + os.path.join(self.opts["pki_dir"], self.ACC, key), ) eload = {"result": True, "act": "accept", "id": key} self.event.fire_event(eload, salt.utils.event.tagify(prefix="key")) diff --git a/salt/states/boto_cognitoidentity.py b/salt/states/boto_cognitoidentity.py index 4731885b9ce..cb6905a2781 100644 --- a/salt/states/boto_cognitoidentity.py +++ b/salt/states/boto_cognitoidentity.py @@ -236,7 +236,7 @@ def pool_present( else: ret[ "comment" - ] = "An existing identity pool named {} with id {}will be updated.".format( + ] = "An existing identity pool named {} with id {} will be updated.".format( IdentityPoolName, IdentityPoolId ) ret["result"] = None diff --git a/salt/states/pbm.py b/salt/states/pbm.py index 68e569c718c..ae21462ea47 100644 --- a/salt/states/pbm.py +++ b/salt/states/pbm.py @@ -430,7 +430,7 @@ def storage_policies_configured(name, policies): service_instance=si, ) comments.append( - "Updated the storage policy '{}'in vCenter '{}'".format( + "Updated the storage policy '{}' in vCenter '{}'".format( policy["name"], vcenter ) ) diff --git a/salt/utils/decorators/path.py b/salt/utils/decorators/path.py index 52730ea38f4..254593553a3 100644 --- a/salt/utils/decorators/path.py +++ b/salt/utils/decorators/path.py @@ -37,7 +37,7 @@ def which_bin(exes): def wrapped(*args, **kwargs): if salt.utils.path.which_bin(exes) is None: raise CommandNotFoundError( - "None of provided binaries({}) was not found in $PATH.".format( + "None of provided binaries({}) were found in $PATH.".format( ["'{}'".format(exe) for exe in exes] ) ) diff --git a/salt/utils/odict.py b/salt/utils/odict.py index bfc22826c5e..f4b26155a5c 100644 --- a/salt/utils/odict.py +++ b/salt/utils/odict.py @@ -311,7 +311,9 @@ except (ImportError, AttributeError): class DefaultOrderedDict(OrderedDict): - "Dictionary that remembers insertion order and" + """ + Dictionary that remembers insertion order + """ def __init__(self, default_factory=None, *a, **kw): if default_factory is not None and not isinstance(default_factory, Callable): diff --git a/tests/salt-tcpdump.py b/tests/salt-tcpdump.py index 2827e684f15..4a92966132b 100644 --- a/tests/salt-tcpdump.py +++ b/tests/salt-tcpdump.py @@ -66,7 +66,7 @@ class ArgParser: default="eth0", dest="iface", required=False, - help="the interface to dump themaster runs on(default:eth0)", + help="The interface to dump the master runs on(default:eth0)", ) self.main_parser.add_argument( @@ -75,7 +75,7 @@ class ArgParser: default=5, dest="ival", required=False, - help="interval for printing stats (default:5)", + help="Interval for printing stats (default:5)", ) self.main_parser.add_argument( @@ -86,7 +86,7 @@ class ArgParser: nargs="?", dest="only_ip", required=False, - help="print unique IPs making new connections with SYN set", + help="Print unique IPs making new connections with SYN set", ) def parse_args(self): diff --git a/tests/support/zfs.py b/tests/support/zfs.py index 6faa0ebdf3e..31fabe3d059 100644 --- a/tests/support/zfs.py +++ b/tests/support/zfs.py @@ -116,6 +116,8 @@ class ZFSMockData: "frag": {"edit": False, "type": "str", "values": ""}, "fragmentation": {"edit": False, "type": "str", "values": ""}, } + + # fmt: off self.pmap_exec_zfs = { "retcode": 2, "stdout": "", @@ -134,8 +136,7 @@ class ZFSMockData: "", " available NO NO ", " clones NO NO [,...]", - " compressratio NO NO <1.00x or higher if" - " compressed>", + " compressratio NO NO <1.00x or higher if compressed>", " creation NO NO ", " defer_destroy NO NO yes | no", " filesystem_count NO NO ", @@ -144,12 +145,10 @@ class ZFSMockData: " mounted NO NO yes | no", " origin NO NO ", " receive_resume_token NO NO ", - " refcompressratio NO NO <1.00x or higher if" - " compressed>", + " refcompressratio NO NO <1.00x or higher if compressed>", " referenced NO NO ", " snapshot_count NO NO ", - " type NO NO filesystem | volume |" - " snapshot | bookmark", + " type NO NO filesystem | volume | snapshot | bookmark", " used NO NO ", " usedbychildren NO NO ", " usedbydataset NO NO ", @@ -157,21 +156,15 @@ class ZFSMockData: " usedbysnapshots NO NO ", " userrefs NO NO ", " written NO NO ", - " aclinherit YES YES discard | noallow |" - " restricted | passthrough | passthrough-x", - " aclmode YES YES discard | groupmask |" - " passthrough | restricted", + " aclinherit YES YES discard | noallow | restricted | passthrough | passthrough-x", + " aclmode YES YES discard | groupmask | passthrough | restricted", " atime YES YES on | off", " canmount YES NO on | off | noauto", - " casesensitivity NO YES sensitive | insensitive |" - " mixed", - " checksum YES YES on | off | fletcher2 |" - " fletcher4 | sha256 | sha512 | skein | edonr", - " compression YES YES on | off | lzjb | gzip |" - " gzip-[1-9] | zle | lz4", + " casesensitivity NO YES sensitive | insensitive | mixed", + " checksum YES YES on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein | edonr", + " compression YES YES on | off | lzjb | gzip | gzip-[1-9] | zle | lz4", " copies YES YES 1 | 2 | 3", - " dedup YES YES on | off | verify |" - " sha256[,verify], sha512[,verify], skein[,verify], edonr,verify", + " dedup YES YES on | off | verify | sha256[,verify], sha512[,verify], skein[,verify], edonr,verify", " devices YES YES on | off", " exec YES YES on | off", " filesystem_limit YES NO | none", @@ -179,8 +172,7 @@ class ZFSMockData: " mlslabel YES YES ", " mountpoint YES YES | legacy | none", " nbmand YES YES on | off", - " normalization NO YES none | formC | formD |" - " formKC | formKD", + " normalization NO YES none | formC | formD | formKC | formKD", " primarycache YES YES all | none | metadata", " quota YES NO | none", " readonly YES YES on | off", @@ -191,17 +183,13 @@ class ZFSMockData: " reservation YES NO | none", " secondarycache YES YES all | none | metadata", " setuid YES YES on | off", - " sharenfs YES YES on | off | share(1M)" - " options", - " sharesmb YES YES on | off | sharemgr(1M)" - " options", + " sharenfs YES YES on | off | share(1M) options", + " sharesmb YES YES on | off | sharemgr(1M) options", " snapdir YES YES hidden | visible", " snapshot_limit YES NO | none", - " sync YES YES standard | always |" - " disabled", + " sync YES YES standard | always | disabled", " utf8only NO YES on | off", - " version YES NO 1 | 2 | 3 | 4 | 5 |" - " current", + " version YES NO 1 | 2 | 3 | 4 | 5 | current", " volblocksize NO YES 512 to 128k, power of 2", " volsize YES NO ", " vscan YES YES on | off", @@ -213,11 +201,9 @@ class ZFSMockData: " groupquota@... YES NO | none", " written@ NO NO ", "", - "Sizes are specified in bytes with standard units such as K, M, G," - " etc.", + "Sizes are specified in bytes with standard units such as K, M, G, etc.", "", - "User-defined properties can be specified by using a name" - " containing a colon (:).", + "User-defined properties can be specified by using a name containing a colon (:).", "", "The {user|group}{used|quota}@ properties must be appended with", "a user or group specifier of one of these forms:", @@ -228,6 +214,7 @@ class ZFSMockData: ] ), } + # fmt: on self.pmap_zfs = { "origin": { "edit": False, diff --git a/tests/unit/states/test_kubernetes.py b/tests/unit/states/test_kubernetes.py index fea1ef4fb66..dc4d80a15df 100644 --- a/tests/unit/states/test_kubernetes.py +++ b/tests/unit/states/test_kubernetes.py @@ -5,17 +5,18 @@ import base64 from contextlib import contextmanager +import pytest +import salt.modules.kubernetesmod as kubernetesmod +import salt.states.kubernetes as kubernetes import salt.utils.stringutils -from salt.states import kubernetes from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import MagicMock, patch -from tests.support.unit import TestCase, skipIf +from tests.support.unit import TestCase -@skipIf( - kubernetes is False, - "Probably Kubernetes client lib is not installed. " - " Skipping test_kubernetes.py", +@pytest.mark.skipif( + kubernetesmod.HAS_LIBS is False, + reason="Probably Kubernetes client lib is not installed. Skipping test_kubernetes.py", ) class KubernetesTestCase(TestCase, LoaderModuleMockMixin): """