From c532db1461d622c2eecd753fe324485f5a22cbb5 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 21 Jan 2015 17:21:34 +0100 Subject: [PATCH] Enable several PEP8 checks * E122 continuation line missing indentation or outdented * E126 continuation line over-indented for hanging indent * E127 continuation line over-indented for visual indent * E128 continuation line under-indented for visual indent * E131 continuation line unaligned for hanging indent * E303 too many blank lines * W601 .has_key() is deprecated, use 'in' * H234 assertEquals is deprecated, use assertEqual * H401 docstring should not start with a space * H402 one line docstring needs punctuation. Change-Id: I1c264dba19bfe7cb9173e8999429827bd026b930 --- docs/conf.py | 16 ++++---- packstack/installer/basedefs.py | 2 - packstack/installer/core/drones.py | 30 +++++++-------- packstack/installer/core/sequences.py | 1 - packstack/installer/output_messages.py | 4 +- packstack/installer/run_setup.py | 38 +++++++++---------- packstack/installer/utils/shell.py | 3 +- packstack/modules/puppet.py | 4 +- packstack/plugins/ceilometer_800.py | 6 +-- packstack/plugins/neutron_350.py | 2 +- .../modules/packstack/lib/facter/netns.py | 4 +- tests/installer/test_processors.py | 6 +-- tests/installer/test_sequences.py | 2 +- tests/installer/test_utils.py | 16 ++++---- tests/installer/test_validators.py | 20 +++++----- tests/modules/test_ospluginutils.py | 2 +- tests/modules/test_puppet.py | 2 +- tests/test_plugin_serverprep.py | 2 +- tox.ini | 2 +- 19 files changed, 79 insertions(+), 83 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d9305ca21..f062349bd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -173,14 +173,14 @@ htmlhelp_basename = 'packstackdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -# 'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -# 'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -# 'preamble': '', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples @@ -229,8 +229,8 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ ('index', 'packstack', u'packstack Documentation', - u'Derek Higgins', 'packstack', 'One line description of project.', - 'Miscellaneous'), + u'Derek Higgins', 'packstack', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. diff --git a/packstack/installer/basedefs.py b/packstack/installer/basedefs.py index 266e20c1e..2a8cbaf72 100644 --- a/packstack/installer/basedefs.py +++ b/packstack/installer/basedefs.py @@ -52,8 +52,6 @@ DIR_PROJECT_DIR = os.environ.get('INSTALLER_PROJECT_DIR', os.path.join(os.getcwd DIR_PLUGINS = os.path.join(DIR_PROJECT_DIR, "plugins") DIR_MODULES = os.path.join(DIR_PROJECT_DIR, "modules") - - EXEC_RPM = "rpm" EXEC_SEMANAGE = "semanage" EXEC_NSLOOKUP = "nslookup" diff --git a/packstack/installer/core/drones.py b/packstack/installer/core/drones.py index 9e82efa57..4c874cc66 100644 --- a/packstack/installer/core/drones.py +++ b/packstack/installer/core/drones.py @@ -24,8 +24,8 @@ class SshTarballTransferMixin(object): script.append("scp %(pack_path)s root@%(node)s:%(pack_dest)s" % args) script.append("ssh -o StrictHostKeyChecking=no " - "-o UserKnownHostsFile=/dev/null root@%(node)s " - "tar -C %(res_dir)s -xpzf %(pack_dest)s" % args) + "-o UserKnownHostsFile=/dev/null root@%(node)s " + "tar -C %(res_dir)s -xpzf %(pack_dest)s" % args) try: script.execute() except ScriptRuntimeError as ex: @@ -124,15 +124,15 @@ class Drone(object): # remote host IP or hostname self.node = node # working directories on remote host - self.resource_dir = resource_dir or \ - '/tmp/drone%s' % uuid.uuid4().hex[:8] - self.recipe_dir = recipe_dir or \ - os.path.join(self.resource_dir, 'recipes') + self.resource_dir = (resource_dir or + '/tmp/drone%s' % uuid.uuid4().hex[:8]) + self.recipe_dir = (recipe_dir or + os.path.join(self.resource_dir, 'recipes')) # temporary directories - self.remote_tmpdir = remote_tmpdir or \ - '/tmp/drone%s' % uuid.uuid4().hex[:8] - self.local_tmpdir = local_tmpdir or \ - tempfile.mkdtemp(prefix='drone') + self.remote_tmpdir = (remote_tmpdir or + '/tmp/drone%s' % uuid.uuid4().hex[:8]) + self.local_tmpdir = (local_tmpdir or + tempfile.mkdtemp(prefix='drone')) def init_node(self): """ @@ -335,7 +335,7 @@ class PackstackDrone(SshTarballTransferMixin, Drone): server = utils.ScriptRunner(self.node) for pkg in ("puppet", "openssh-clients", "tar"): server.append("rpm -q --whatprovides %(pkg)s || " - "yum install -y %(pkg)s" % locals()) + "yum install -y %(pkg)s" % locals()) server.execute() def add_resource(self, path, resource_type=None): @@ -352,8 +352,8 @@ class PackstackDrone(SshTarballTransferMixin, Drone): recipe_base.replace(".finished", ".log")) local = utils.ScriptRunner() local.append('scp -o StrictHostKeyChecking=no ' - '-o UserKnownHostsFile=/dev/null ' - 'root@%s:%s %s' % (self.node, recipe, log)) + '-o UserKnownHostsFile=/dev/null ' + 'root@%s:%s %s' % (self.node, recipe, log)) try: # once a remote puppet run has finished, we retrieve # the log file and check it for errors @@ -390,8 +390,8 @@ class PackstackDrone(SshTarballTransferMixin, Drone): mdir = self._module_dir server.append( "( flock %(rdir)s/ps.lock " - "puppet apply %(loglevel)s --modulepath %(mdir)s " - "%(recipe)s > %(running)s 2>&1 < /dev/null; " + "puppet apply %(loglevel)s --modulepath %(mdir)s " + "%(recipe)s > %(running)s 2>&1 < /dev/null; " "mv %(running)s %(finished)s ) " "> /dev/null 2>&1 < /dev/null &" % locals()) server.execute() diff --git a/packstack/installer/core/sequences.py b/packstack/installer/core/sequences.py index a9680be8e..64c76cbb6 100644 --- a/packstack/installer/core/sequences.py +++ b/packstack/installer/core/sequences.py @@ -48,7 +48,6 @@ class Step(object): sys.stdout.flush() - class Sequence(object): """ Wrapper for sequence of setup steps. diff --git a/packstack/installer/output_messages.py b/packstack/installer/output_messages.py index c7f52f667..840028e28 100644 --- a/packstack/installer/output_messages.py +++ b/packstack/installer/output_messages.py @@ -52,8 +52,8 @@ INFO_REMOVE_REMOTE_VAR = "Removing %s on %s (if it is a remote host)" WARN_WEAK_PASS = "Warning: Weak Password." WARN_NM_ENABLED = ("Warning: NetworkManager is active on %s. OpenStack " - "networking currently does not work on systems that have " - "the Network Manager service enabled.") + "networking currently does not work on systems that have " + "the Network Manager service enabled.") ERR_PING = "Error: the provided hostname is unreachable" ERR_SSH = "Error: could not connect to the ssh server: %s" diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index c82d66c80..233920e67 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -77,7 +77,7 @@ def _getInputFromUser(param): else: while loop: # If the value was not supplied by the command line flags - if not commandLineValues.has_key(param.CONF_NAME): + if param.CONF_NAME not in commandLineValues: message = StringIO() message.write(param.PROMPT) @@ -121,11 +121,11 @@ def _getInputFromUser(param): controller.CONF[param.CONF_NAME] = userInput continue else: - if commandLineValues.has_key(param.CONF_NAME): + if param.CONF_NAME in commandLineValues: del commandLineValues[param.CONF_NAME] else: # Delete value from commandLineValues so that we will prompt the user for input - if commandLineValues.has_key(param.CONF_NAME): + if param.CONF_NAME in commandLineValues: del commandLineValues[param.CONF_NAME] loop = True except KeyboardInterrupt: @@ -144,7 +144,7 @@ def input_param(param): """ # We need to check if a param needs confirmation, (i.e. ask user twice) # Do not validate if it was given from the command line - if (param.NEED_CONFIRM and not commandLineValues.has_key(param.CONF_NAME)): + if param.NEED_CONFIRM and param.CONF_NAME not in commandLineValues: # create a copy of the param so we can call it twice confirmedParam = copy.deepcopy(param) confirmedParamName = param.CONF_NAME + "_CONFIRMED" @@ -492,9 +492,9 @@ def _handleInteractiveParams(): # we clear the value of all params in the group # in order to re-input them by the user for param in group.parameters.itervalues(): - if controller.CONF.has_key(param.CONF_NAME): + if param.CONF_NAME in controller.CONF: del controller.CONF[param.CONF_NAME] - if commandLineValues.has_key(param.CONF_NAME): + if param.CONF_NAME in commandLineValues: del commandLineValues[param.CONF_NAME] else: inputLoop = False @@ -529,7 +529,7 @@ def _getConditionValue(matchMember): elif isinstance(matchMember, types.StringType): # we assume that if we get a string as a member it is the name # of a member of conf_params - if not controller.CONF.has_key(matchMember): + if matchMember not in controller.CONF: param = controller.getParamByName(matchMember) input_param(param) returnValue = controller.CONF[matchMember] @@ -546,7 +546,7 @@ def _displaySummary(): logging.info("*** User input summary ***") for group in controller.getAllGroups(): for param in group.parameters.itervalues(): - if not param.USE_DEFAULT and controller.CONF.has_key(param.CONF_NAME): + if not param.USE_DEFAULT and param.CONF_NAME in controller.CONF: cmdOption = param.CMD_OPTION l = 30 - len(cmdOption) maskParam = param.MASK_INPUT @@ -564,14 +564,14 @@ def _displaySummary(): logging.debug("user chose to re-enter the user parameters") for group in controller.getAllGroups(): for param in group.parameters.itervalues(): - if controller.CONF.has_key(param.CONF_NAME): + if param.CONF_NAME in controller.CONF: if not param.MASK_INPUT: param.DEFAULT_VALUE = controller.CONF[param.CONF_NAME] # Remove the string from mask_value_set in order # to remove values that might be over overwritten. removeMaskString(controller.CONF[param.CONF_NAME]) del controller.CONF[param.CONF_NAME] - if commandLineValues.has_key(param.CONF_NAME): + if param.CONF_NAME in commandLineValues: del commandLineValues[param.CONF_NAME] print "" logging.debug("calling handleParams in interactive mode") @@ -602,7 +602,7 @@ def _summaryParamsToLog(): logging.debug("*** The following params were used as user input:") for group in controller.getAllGroups(): for param in group.parameters.itervalues(): - if controller.CONF.has_key(param.CONF_NAME): + if param.CONF_NAME in controller.CONF: maskedValue = mask(controller.CONF[param.CONF_NAME]) logging.debug("%s: %s" % (param.CMD_OPTION, maskedValue)) @@ -725,7 +725,7 @@ def generateAnswerFile(outputFile, overrides={}): def single_step_aio_install(options, logFile): - """ Installs an All in One host on this host""" + """Installs an All in One host on this host.""" options.install_hosts = utils.get_localhost_ip() @@ -788,15 +788,15 @@ def initCmdLineParser(): usage = "usage: %prog [options] [--help]" parser = OptionParser(usage=usage, version="%prog {0} {1}".format(version.release_string(), version.version_string())) parser.add_option("--gen-answer-file", help="Generate a template of an answer file, using this option excludes all other options") - parser.add_option("--answer-file", help="Runs the configuration in non-interactive mode, extracting all information from the \ - configuration file. using this option excludes all other options") + parser.add_option("--answer-file", help="Runs the configuration in non-interactive mode, extracting all information from the" + "configuration file. using this option excludes all other options") parser.add_option("--install-hosts", help="Install on a set of hosts in a single step. The format should be a comma separated list " - "of hosts, the first is setup as a controller, and the others are setup as compute nodes." - "if only a single host is supplied then it is setup as an all in one installation. An answerfile " - "will also be generated and should be used if Packstack needs to be run a second time ") + "of hosts, the first is setup as a controller, and the others are setup as compute nodes." + "if only a single host is supplied then it is setup as an all in one installation. An answerfile " + "will also be generated and should be used if Packstack needs to be run a second time ") parser.add_option("--allinone", action="store_true", help="Shorthand for --install-hosts= --novanetwork-pubif= " - "--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y " - ", this option can be used to install an all in one OpenStack on this host") + "--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y " + ", this option can be used to install an all in one OpenStack on this host") parser.add_option("-t", "--timeout", default=300, help="The timeout for puppet Exec calls") parser.add_option("-o", "--options", action="store_true", dest="options", help="Print details on options available in answer file(rst format)") diff --git a/packstack/installer/utils/shell.py b/packstack/installer/utils/shell.py index c78087b98..33c8b5854 100644 --- a/packstack/installer/utils/shell.py +++ b/packstack/installer/utils/shell.py @@ -90,8 +90,7 @@ class ScriptRunner(object): environ = os.environ environ['LANG'] = 'en_US.UTF8' obj = subprocess.Popen(cmd, stdin=_PIPE, stdout=_PIPE, stderr=_PIPE, - close_fds=True, shell=False, - env=environ) + close_fds=True, shell=False, env=environ) script = "function t(){ exit $? ; } \n trap t ERR \n" + script out, err = obj.communicate(script) diff --git a/packstack/modules/puppet.py b/packstack/modules/puppet.py index cdc02f5af..ddec2cac0 100644 --- a/packstack/modules/puppet.py +++ b/packstack/modules/puppet.py @@ -34,8 +34,8 @@ re_ignore = re.compile( 'NetworkManager is not running' ) re_notice = re.compile(r"notice: .*Notify\[packstack_info\]" - "\/message: defined \'message\' as " - "\'(?P.*)\'") + "\/message: defined \'message\' as " + "\'(?P.*)\'") surrogates = [ # Value in /etc/sysctl.conf cannot be changed diff --git a/packstack/plugins/ceilometer_800.py b/packstack/plugins/ceilometer_800.py index f35d6a87c..452ea2bfb 100644 --- a/packstack/plugins/ceilometer_800.py +++ b/packstack/plugins/ceilometer_800.py @@ -310,10 +310,10 @@ def create_redis_manifest(config, messages): slave_clients = set([config['CONFIG_CONTROLLER_HOST']]).union( split_hosts(config['CONFIG_REDIS_SLAVE_HOSTS'])).union( - split_hosts(config['CONFIG_REDIS_SENTINEL_HOSTS'])) + split_hosts(config['CONFIG_REDIS_SENTINEL_HOSTS'])) config['FIREWALL_REDIS_SLAVE_RULES'] = ( - _create_redis_firewall_rules( - slave_clients, config['CONFIG_REDIS_PORT'])) + _create_redis_firewall_rules( + slave_clients, config['CONFIG_REDIS_PORT'])) manifestdata += createFirewallResources( 'FIREWALL_REDIS_SLAVE_RULES') diff --git a/packstack/plugins/neutron_350.py b/packstack/plugins/neutron_350.py index 95259de01..a692fea76 100644 --- a/packstack/plugins/neutron_350.py +++ b/packstack/plugins/neutron_350.py @@ -601,7 +601,7 @@ def create_manifests(config, messages): if use_openvswitch_vxlan(config) or use_openvswitch_gre(config): for n_host in network_hosts: cf_fw_nt_key = ("FIREWALL_NEUTRON_TUNNEL_RULES_%s_%s" - % (host, n_host)) + % (host, n_host)) fw_details = dict() key = "neutron_tunnel_%s_%s" % (host, n_host) fw_details.setdefault(key, {}) diff --git a/packstack/puppet/modules/packstack/lib/facter/netns.py b/packstack/puppet/modules/packstack/lib/facter/netns.py index a24d90c4a..14f2f82d6 100644 --- a/packstack/puppet/modules/packstack/lib/facter/netns.py +++ b/packstack/puppet/modules/packstack/lib/facter/netns.py @@ -117,8 +117,8 @@ class TestNetns(unittest.TestCase): # Check that iptables filtering and save/restore can be performed try: iptables_filename = os.path.join( - tempfile.gettempdir(), - 'iptables-%s' % str(uuid.uuid4())) + tempfile.gettempdir(), + 'iptables-%s' % str(uuid.uuid4())) e('%%(ns1)s iptables-save > %s' % iptables_filename) e('%(ns1)s iptables -A INPUT -p icmp --icmp-type 8 -j DROP') e('%(ns2)s ping -c 1 -w 1 %(address1_1)s', return_code=1) diff --git a/tests/installer/test_processors.py b/tests/installer/test_processors.py index e97ca7276..11485a918 100644 --- a/tests/installer/test_processors.py +++ b/tests/installer/test_processors.py @@ -24,15 +24,15 @@ from ..test_base import PackstackTestCaseMixin class ProcessorsTestCase(PackstackTestCaseMixin, TestCase): def test_process_host(self): - """Test packstack.installer.processors.process_host""" + """Test packstack.installer.processors.process_host.""" proc_local = process_host('localhost', 'HOSTNAME') self.assertIn(proc_local, ['127.0.0.1', '::1']) def test_process_ssh_key(self): - """Test packstack.installer.processors.process_ssh_key""" + """Test packstack.installer.processors.process_ssh_key.""" path = process_ssh_key(os.path.join(self.tempdir, 'id_rsa'), 'SSH_KEY') # test if key was created - self.assertEquals(True, bool(path)) + self.assertEqual(True, bool(path)) # test if key exists # XXX: process_ssh_key does not create ssh key during test run # ... not sure why, nevertheless it works in normal run diff --git a/tests/installer/test_sequences.py b/tests/installer/test_sequences.py index a7bcf5c35..6feea44ed 100644 --- a/tests/installer/test_sequences.py +++ b/tests/installer/test_sequences.py @@ -67,7 +67,7 @@ class SequenceTestCase(PackstackTestCaseMixin, TestCase): 'title': 'Step 3'}] self.seq = Sequence('test', self.steps, condition='test', - cond_match='test') + cond_match='test') def tearDown(self): super(SequenceTestCase, self).tearDown() diff --git a/tests/installer/test_utils.py b/tests/installer/test_utils.py index c538f05ca..34dd69292 100644 --- a/tests/installer/test_utils.py +++ b/tests/installer/test_utils.py @@ -44,7 +44,7 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): shutil.rmtree(self.tempdir) def test_sorteddict(self): - """Test packstack.installer.utils.datastructures.SortedDict""" + """Test packstack.installer.utils.datastructures.SortedDict.""" sdict = SortedDict() sdict['1'] = 1 sdict['2'] = 2 @@ -53,7 +53,7 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): self.assertListEqual(sdict.values(), [1, 2, 3, 4, 5]) def test_retry(self): - """Test packstack.installer.utils.decorators.retry""" + """Test packstack.installer.utils.decorators.retry.""" @retry(count=3, delay=0, retry_on=ValueError) def test_sum(): @@ -72,12 +72,12 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): self.assertRaises(ValueError, test_sum) def test_network(self): - """Test packstack.installer.utils.network functions""" + """Test packstack.installer.utils.network functions.""" self.assertIn(host2ip('localhost', allow_localhost=True), ['127.0.0.1', '::1']) def test_shell(self): - """Test packstack.installer.utils.shell functions""" + """Test packstack.installer.utils.shell functions.""" rc, out = execute(['echo', 'this is test']) self.assertEqual(out.strip(), 'this is test') rc, out = execute('echo "this is test"', use_shell=True) @@ -97,9 +97,9 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): self.assertEqual(out.strip(), 'this is test') def test_strings(self): - """Test packstack.installer.utils.strings functions""" + """Test packstack.installer.utils.strings functions.""" self.assertEqual(color_text('test text', 'red'), - '\033[0;31mtest text\033[0m') + '\033[0;31mtest text\033[0m') self.assertEqual(mask_string('test text', mask_list=['text']), 'test %s' % STR_MASK) masked = mask_string("test '\\''text'\\''", @@ -108,9 +108,9 @@ class ParameterTestCase(PackstackTestCaseMixin, TestCase): self.assertEqual(masked, 'test %s' % STR_MASK) def test_shortcuts(self): - """Test packstack.installer.utils.shortcuts functions""" + """Test packstack.installer.utils.shortcuts functions.""" conf = {"A_HOST": "1.1.1.1", "B_HOSTS": "2.2.2.2,1.1.1.1", "C_HOSTS": "3.3.3.3/vdc"} hostlist = list(hosts(conf)) hostlist.sort() - self.assertEquals(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hostlist) + self.assertEqual(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hostlist) diff --git a/tests/installer/test_validators.py b/tests/installer/test_validators.py index e81e59fa7..68e094878 100644 --- a/tests/installer/test_validators.py +++ b/tests/installer/test_validators.py @@ -34,24 +34,24 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase): shutil.rmtree(self.tempdir) def test_validate_integer(self): - """Test packstack.installer.validators.validate_integer""" + """Test packstack.installer.validators.validate_integer.""" validate_integer('1') self.assertRaises(ParamValidationError, validate_integer, 'test') def test_validate_regexp(self): - """Test packstack.installer.validators.validate_regexp""" + """Test packstack.installer.validators.validate_regexp.""" validate_regexp('Test_123', options=['\w']) self.assertRaises(ParamValidationError, validate_regexp, '!#$%', options=['\w']) def test_validate_port(self): - """Test packstack.installer.validators.validate_port""" + """Test packstack.installer.validators.validate_port.""" validate_port('666') self.assertRaises(ParamValidationError, validate_port, 'test') self.assertRaises(ParamValidationError, validate_port, '-3') def test_validate_not_empty(self): - """Test packstack.installer.validators.validate_not_empty""" + """Test packstack.installer.validators.validate_not_empty.""" validate_not_empty('test') validate_not_empty(False) self.assertRaises(ParamValidationError, validate_not_empty, '') @@ -59,20 +59,20 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase): self.assertRaises(ParamValidationError, validate_not_empty, {}) def test_validate_options(self): - """Test packstack.installer.validators.validate_options""" + """Test packstack.installer.validators.validate_options.""" validate_options('a', options=['a', 'b']) validate_options('b', options=['a', 'b']) self.assertRaises(ParamValidationError, validate_options, 'c', options=['a', 'b']) def test_validate_ip(self): - """Test packstack.installer.validators.validate_ip""" + """Test packstack.installer.validators.validate_ip.""" validate_ip('127.0.0.1') validate_ip('::1') self.assertRaises(ParamValidationError, validate_ip, 'test') def test_validate_file(self): - """Test packstack.installer.validators.validate_file""" + """Test packstack.installer.validators.validate_file.""" fname = os.path.join(self.tempdir, '.test_validate_file') bad_name = os.path.join(self.tempdir, '.me_no_exists') with open(fname, 'w') as f: @@ -81,18 +81,18 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase): self.assertRaises(ParamValidationError, validate_file, bad_name) def test_validate_ping(self): - """Test packstack.installer.validators.validate_ping""" + """Test packstack.installer.validators.validate_ping.""" # ping to broadcast fails self.assertRaises(ParamValidationError, validate_ping, '255.255.255.255') def test_validate_ssh(self): - """Test packstack.installer.validators.validate_ssh""" + """Test packstack.installer.validators.validate_ssh.""" # ssh to broadcast fails self.assertRaises(ParamValidationError, validate_ssh, '255.255.255.255') def test_validate_float(self): - """Test packstack.installer.validators.validate_float""" + """Test packstack.installer.validators.validate_float.""" validate_float('5.3') self.assertRaises(ParamValidationError, validate_float, 'test') diff --git a/tests/modules/test_ospluginutils.py b/tests/modules/test_ospluginutils.py index 63077ad67..1691503e1 100644 --- a/tests/modules/test_ospluginutils.py +++ b/tests/modules/test_ospluginutils.py @@ -27,4 +27,4 @@ class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase): "C_HOSTS": "3.3.3.3/vdc"} hosts = gethostlist(conf) hosts.sort() - self.assertEquals(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hosts) + self.assertEqual(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hosts) diff --git a/tests/modules/test_puppet.py b/tests/modules/test_puppet.py index 0cefdcc16..825aa8f65 100644 --- a/tests/modules/test_puppet.py +++ b/tests/modules/test_puppet.py @@ -27,7 +27,7 @@ from packstack.modules.puppet import validate_logfile class PuppetTestCase(PackstackTestCaseMixin, TestCase): def test_validate_logfile(self): - """Test packstack.modules.validate_logfile""" + """Test packstack.modules.validate_logfile.""" filename = os.path.join(self.tempdir, "puppet.log") # test valid run with open(filename, "w") as fp: diff --git a/tests/test_plugin_serverprep.py b/tests/test_plugin_serverprep.py index 11001e42d..5884de153 100644 --- a/tests/test_plugin_serverprep.py +++ b/tests/test_plugin_serverprep.py @@ -22,7 +22,7 @@ from packstack.plugins import serverprep_001 class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase): def test_rhn_creds_quoted(self): - """Make sure RHN password is quoted""" + """Make sure RHN password is quoted.""" # On non-RHEL, the CONFIG_{RH,SATELLITE} options are never set, # i.e. this test would always fail. Therefore, only run it on RHEL. diff --git a/tox.ini b/tox.ini index ec837b1d2..584e0448e 100644 --- a/tox.ini +++ b/tox.ini @@ -33,6 +33,6 @@ commands = python setup.py build_sphinx # E123, E125 skipped as they are invalid PEP-8. # # All other checks should be enabled in the future. -ignore = E123,E125,H803,E128,F403,F821,E127,F811,F841,E501,W601,E131,E126,E303,E122,H402,H302,H303,H304,H301,H306,H234,H405,H404,H904,H201,H305,H307,H501,H102,H233,H101,H233,H401,H232 +ignore = E123,E125,H803,F403,F821,F811,F841,E501,H302,H303,H304,H301,H306,H405,H404,H904,H201,H305,H307,H501,H102,H233,H101,H233,H232 show-source = True exclude=.venv,.git,.tox