From 5f46962e807b65a8e9e48f96ef7c17bddfb38729 Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Tue, 3 Dec 2013 22:54:38 +0000 Subject: [PATCH 1/2] pep8 fixes --- doc/_ext/youtube.py | 20 ++- doc/conf.py | 4 +- pkg/rpm/build.py | 8 +- salt/cli/__init__.py | 4 +- salt/modules/dockerio.py | 2 +- salt/modules/network.py | 2 +- salt/modules/zcbuildout.py | 5 +- salt/runners/manage.py | 11 +- .../files/file/base/_modules/override_test.py | 1 + .../file/base/_modules/runtests_decorators.py | 5 + .../buildout/var/ver/1/bootstrap/bootstrap.py | 2 +- .../buildout/var/ver/2/bootstrap/bootstrap.py | 2 +- tests/integration/modules/state.py | 6 +- tests/unit/modules/file_test.py | 124 ++++++++++++++---- tests/unit/modules/zcbuildout_test.py | 6 +- tests/unit/states/zcbuildout_test.py | 10 +- 16 files changed, 147 insertions(+), 65 deletions(-) diff --git a/doc/_ext/youtube.py b/doc/_ext/youtube.py index e810ff3a43..9039abddea 100644 --- a/doc/_ext/youtube.py +++ b/doc/_ext/youtube.py @@ -6,21 +6,21 @@ # If not otherwise noted, the extensions in this package are licensed # under the following license. -# +# # Copyright (c) 2009 by the contributors (see AUTHORS file). # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. -# +# # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -42,6 +42,7 @@ from sphinx.util.compat import Directive CONTROL_HEIGHT = 30 + def get_size(d, key): if key not in d: return None @@ -50,10 +51,14 @@ def get_size(d, key): raise ValueError("invalid size %r" % d[key]) return int(m.group(1)), m.group(2) or "px" + def css(d): return "; ".join(sorted("%s: %s" % kv for kv in d.iteritems())) -class youtube(nodes.General, nodes.Element): pass + +class youtube(nodes.General, nodes.Element): + pass + def visit_youtube_node(self, node): aspect = node["aspect"] @@ -105,9 +110,11 @@ def visit_youtube_node(self, node): self.body.append(self.starttag(node, "iframe", **attrs)) self.body.append("") + def depart_youtube_node(self, node): pass + class YouTube(Directive): has_content = True required_arguments = 1 @@ -132,6 +139,7 @@ class YouTube(Directive): height = get_size(self.options, "height") return [youtube(id=self.arguments[0], aspect=aspect, width=width, height=height)] + def setup(app): app.add_node(youtube, html=(visit_youtube_node, depart_youtube_node)) app.add_directive("youtube", YouTube) diff --git a/doc/conf.py b/doc/conf.py index 90e183b529..cbffe1a777 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -88,8 +88,8 @@ except NameError: docs_basepath = os.path.abspath(os.path.dirname('.')) addtl_paths = ( - os.pardir, # salt itself (for autodoc) - '_ext', # custom Sphinx extensions + os.pardir, # salt itself (for autodoc) + '_ext', # custom Sphinx extensions ) for path in addtl_paths: diff --git a/pkg/rpm/build.py b/pkg/rpm/build.py index 2d7abd1e81..ef1b502e63 100755 --- a/pkg/rpm/build.py +++ b/pkg/rpm/build.py @@ -9,7 +9,7 @@ from shutil import copy from subprocess import check_call parser = argparse.ArgumentParser( - description = 'Build salt rpms', + description='Build salt rpms', ) parser.add_argument('buildid', help='The build id to use i.e. the bit after the salt version in the package name', @@ -38,8 +38,8 @@ def srcfilter(ti): return ti with tarfile.open(join(rpmbuild, 'SOURCES/salt-%s.tar.gz' % salt_version), 'w|gz') as tf: - tf.add(src, arcname = 'salt-%s' % salt_version, - filter = srcfilter) + tf.add(src, arcname='salt-%s' % salt_version, + filter=srcfilter) cmd = ['rpmbuild', '-bb', @@ -47,4 +47,4 @@ cmd = ['rpmbuild', '-bb', '--define=buildid %s' % args.buildid, 'salt.spec'] print('Executing: %s' % ' '.join('"%s"' % c for c in cmd)) -check_call(cmd, cwd = join(rpmbuild, 'SPECS')) +check_call(cmd, cwd=join(rpmbuild, 'SPECS')) diff --git a/salt/cli/__init__.py b/salt/cli/__init__.py index a9f8ae4e08..22e8d41c63 100644 --- a/salt/cli/__init__.py +++ b/salt/cli/__init__.py @@ -285,12 +285,12 @@ class SaltCall(parsers.SaltCallOptionParser): if self.options.file_root: # check if the argument is pointing to a file on disk file_root = os.path.abspath(self.options.file_root) - self.config['file_roots'] = {'base': [file_root]} + self.config['file_roots'] = {'base': [file_root]} if self.options.pillar_root: # check if the argument is pointing to a file on disk pillar_root = os.path.abspath(self.options.pillar_root) - self.config['pillar_roots'] = {'base': [pillar_root]} + self.config['pillar_roots'] = {'base': [pillar_root]} if self.options.local: self.config['file_client'] = 'local' diff --git a/salt/modules/dockerio.py b/salt/modules/dockerio.py index e46c539804..cd2193ec71 100644 --- a/salt/modules/dockerio.py +++ b/salt/modules/dockerio.py @@ -1725,7 +1725,7 @@ def push(repo, *args, **kwargs): return status -def _run_wrapper(status, container, func, cmd, *args, **kwargs): +def _run_wrapper(status, container, func, cmd, *args, **kwargs): ''' Wrapper to a cmdmod function diff --git a/salt/modules/network.py b/salt/modules/network.py index e0d7d1ef75..14d95408a8 100644 --- a/salt/modules/network.py +++ b/salt/modules/network.py @@ -165,7 +165,7 @@ def traceroute(host): 'ip': traceline[2], } for x in range(0, len(delays)): - result['ms{0}'.format(x+1)] = delays[x] + result['ms{0}'.format(x + 1)] = delays[x] except IndexError: result = {} diff --git a/salt/modules/zcbuildout.py b/salt/modules/zcbuildout.py index 2b84f7a9ee..1d645a40bc 100644 --- a/salt/modules/zcbuildout.py +++ b/salt/modules/zcbuildout.py @@ -178,7 +178,7 @@ def _set_status(m, outlog_by_level += hr for level, msg in m['logs']: outlog += '\n{0}: {1}\n'.format(level.upper(), msg) - for logger in 'error', 'warn', 'info', 'debug': + for logger in 'error', 'warn', 'info', 'debug': logs = m['logs_by_level'].get(logger, []) if logs: outlog_by_level += '\n{0}:\n'.format(logger.upper()) @@ -860,6 +860,7 @@ def buildout(directory=".", debug=debug) # signal the decorator or our return raise ResultTransmission(_merge_statuses([boot_ret, buildout_ret])) + return True # make pylint happy def _check_onlyif_unless(onlyif, unless, directory, runas=None, env=()): @@ -874,7 +875,7 @@ def _check_onlyif_unless(onlyif, unless, directory, runas=None, env=()): _valid(status, 'onlyif execution failed') elif isinstance(onlyif, string_types): if retcode(onlyif, cwd=directory, runas=runas, env=env) != 0: - _valid(status, 'onlyif execution failed') + _valid(status, 'onlyif execution failed') if unless is not None: if not isinstance(unless, string_types): if unless: diff --git a/salt/runners/manage.py b/salt/runners/manage.py index 2bcfbc6041..5ae947a196 100644 --- a/salt/runners/manage.py +++ b/salt/runners/manage.py @@ -331,7 +331,7 @@ def bootstrap_psexec(hosts='', master=None, version=None, arch='win32', version = source_list[0][1] arch = source_list[0][2] - installer_url = base_url+source_list[0][0] + installer_url = base_url + source_list[0][0] # It's no secret that Windows is notoriously command-line hostile. # Win 7 and newer can use PowerShell out of the box, but to reach @@ -390,9 +390,10 @@ objShell.Exec("{1}{2}")''' # from a file. Glue it together line by line. for x, y in ((vb_vcrunexec, vb_vcrun), (vb_saltexec, vb_salt)): vb_lines = y.split('\n') - batch += '\ndel '+x+'\n@echo '+vb_lines[0]+' >'+x+'.vbs\n@echo ' + \ - (' >>'+x+'.vbs\n@echo ').join(vb_lines[1:]) + \ - ' >>'+x+'.vbs\ncscript.exe /NoLogo '+x+'.vbs' + batch += '\ndel ' + x + '\n@echo ' + vb_lines[0] + ' >' + \ + x + '.vbs\n@echo ' + \ + (' >>' + x + '.vbs\n@echo ').join(vb_lines[1:]) + \ + ' >>' + x + '.vbs\ncscript.exe /NoLogo ' + x + '.vbs' batch_path = tempfile.mkstemp(suffix='.bat')[1] batch_file = open(batch_path, 'wb') @@ -400,7 +401,7 @@ objShell.Exec("{1}{2}")''' batch_file.close() for host in hosts.split(","): - argv = ['psexec', '\\\\'+host] + argv = ['psexec', '\\\\' + host] if username: argv += ['-u', username] if password: diff --git a/tests/integration/files/file/base/_modules/override_test.py b/tests/integration/files/file/base/_modules/override_test.py index a4aa979271..602476637e 100644 --- a/tests/integration/files/file/base/_modules/override_test.py +++ b/tests/integration/files/file/base/_modules/override_test.py @@ -5,6 +5,7 @@ Module for running arbitrary tests __virtualname__ = 'test' + def __virtual__(): return __virtualname__ diff --git a/tests/integration/files/file/base/_modules/runtests_decorators.py b/tests/integration/files/file/base/_modules/runtests_decorators.py index 5bd0fdebda..4cf8e86f49 100644 --- a/tests/integration/files/file/base/_modules/runtests_decorators.py +++ b/tests/integration/files/file/base/_modules/runtests_decorators.py @@ -3,6 +3,7 @@ import salt.utils.decorators import time + def _fallbackfunc(): return False, 'fallback' @@ -13,22 +14,26 @@ def working_function(): ''' return True + @salt.utils.decorators.depends('time') def depends(): ret = {'ret': True, 'time': time.time()} return ret + @salt.utils.decorators.depends('time123') def missing_depends(): return True + @salt.utils.decorators.depends('time', fallback_function=_fallbackfunc) def depends_will_fallback(): ret = {'ret': True, 'time': time.time()} return ret + @salt.utils.decorators.depends('time123', fallback_function=_fallbackfunc) def missing_depends_will_fallback(): ret = {'ret': True, diff --git a/tests/integration/files/file/base/buildout/var/ver/1/bootstrap/bootstrap.py b/tests/integration/files/file/base/buildout/var/ver/1/bootstrap/bootstrap.py index 8b13789179..792d600548 100644 --- a/tests/integration/files/file/base/buildout/var/ver/1/bootstrap/bootstrap.py +++ b/tests/integration/files/file/base/buildout/var/ver/1/bootstrap/bootstrap.py @@ -1 +1 @@ - +# diff --git a/tests/integration/files/file/base/buildout/var/ver/2/bootstrap/bootstrap.py b/tests/integration/files/file/base/buildout/var/ver/2/bootstrap/bootstrap.py index 8b13789179..792d600548 100644 --- a/tests/integration/files/file/base/buildout/var/ver/2/bootstrap/bootstrap.py +++ b/tests/integration/files/file/base/buildout/var/ver/2/bootstrap/bootstrap.py @@ -1 +1 @@ - +# diff --git a/tests/integration/modules/state.py b/tests/integration/modules/state.py index c5cef501d0..7b5bb9f18e 100644 --- a/tests/integration/modules/state.py +++ b/tests/integration/modules/state.py @@ -610,7 +610,7 @@ fi expected_result_simple = { 'cmd_|-A_|-echo A third_|-run': { '__run_num__': 2, - 'comment': 'Command "echo A third" run', + 'comment': 'Command "echo A third" run', 'result': True}, 'cmd_|-B_|-echo B first_|-run': { '__run_num__': 0, @@ -636,7 +636,7 @@ fi expected_result_simple2 = { 'cmd_|-A_|-echo A_|-run': { '__run_num__': 1, - 'comment': 'Command "echo A" run', + 'comment': 'Command "echo A" run', 'result': True}, 'cmd_|-B_|-echo B_|-run': { '__run_num__': 2, @@ -658,7 +658,7 @@ fi expected_result_complex = { 'cmd_|-A_|-echo A fourth_|-run': { '__run_num__': 3, - 'comment': 'Command "echo A fourth" run', + 'comment': 'Command "echo A fourth" run', 'result': True}, 'cmd_|-B_|-echo B first_|-run': { '__run_num__': 0, diff --git a/tests/unit/modules/file_test.py b/tests/unit/modules/file_test.py index 2774a8b001..4721bde772 100644 --- a/tests/unit/modules/file_test.py +++ b/tests/unit/modules/file_test.py @@ -14,10 +14,12 @@ ensure_in_syspath('../../') # Import Salt libs from salt.modules import file as filemod +from salt.modules import config as configmod from salt.modules import cmdmod -from salt.exceptions import CommandExecutionError, SaltInvocationError +from salt.exceptions import CommandExecutionError filemod.__salt__ = { + 'config.manage_mode': configmod.manage_mode, 'cmd.run': cmdmod.run, 'cmd.run_all': cmdmod.run_all } @@ -87,21 +89,24 @@ class FileReplaceTestCase(TestCase): self.assertEqual(before_ctime, after_ctime) def test_show_changes(self): - ret = filemod.replace(self.tfile.name, r'Etiam', 'Salticus', - show_changes=True) + ret = filemod.replace(self.tfile.name, + r'Etiam', 'Salticus', + show_changes=True) self.assertTrue(ret.startswith('---')) # looks like a diff def test_noshow_changes(self): - ret = filemod.replace(self.tfile.name, r'Etiam', 'Salticus', - show_changes=False) + ret = filemod.replace(self.tfile.name, + r'Etiam', 'Salticus', + show_changes=False) self.assertIsInstance(ret, bool) def test_re_str_flags(self): # upper- & lower-case - filemod.replace(self.tfile.name, r'Etiam', 'Salticus', - flags=['MULTILINE', 'ignorecase']) + filemod.replace(self.tfile.name, + r'Etiam', 'Salticus', + flags=['MULTILINE', 'ignorecase']) def test_re_int_flags(self): filemod.replace(self.tfile.name, r'Etiam', 'Salticus', flags=10) @@ -136,7 +141,8 @@ class FileBlockReplaceTestCase(TestCase): ''') def setUp(self): - self.tfile = tempfile.NamedTemporaryFile(delete=False, prefix='blockrepltmp') + self.tfile = tempfile.NamedTemporaryFile(delete=False, + prefix='blockrepltmp') self.tfile.write(self.MULTILINE_STRING) self.tfile.close() manage_mode_mock = MagicMock() @@ -146,12 +152,23 @@ class FileBlockReplaceTestCase(TestCase): os.remove(self.tfile.name) def test_replace_multiline(self): - new_multiline_content = "Who's that then?\nWell, how'd you become king, then?\nWe found them. I'm not a witch.\nWe shall say 'Ni' again to you, if you do not appease us." - filemod.blockreplace(self.tfile.name, '#-- START BLOCK 1', '#-- END BLOCK 1', new_multiline_content, backup=False) + new_multiline_content = ( + "Who's that then?\nWell, how'd you become king," + "then?\nWe found them. I'm not a witch.\nWe shall" + "say 'Ni' again to you, if you do not appease us." + ) + filemod.blockreplace(self.tfile.name, + '#-- START BLOCK 1', + '#-- END BLOCK 1', + new_multiline_content, + backup=False) with open(self.tfile.name, 'rb') as fp: filecontent = fp.read() - self.assertIn('#-- START BLOCK 1'+"\n"+new_multiline_content+"\n"+'#-- END BLOCK 1', filecontent) + self.assertIn('#-- START BLOCK 1' + + "\n" + new_multiline_content + + "\n" + + '#-- END BLOCK 1', filecontent) self.assertNotIn('old content part 1', filecontent) self.assertNotIn('old content part 2', filecontent) @@ -169,12 +186,21 @@ class FileBlockReplaceTestCase(TestCase): backup=False ) with open(self.tfile.name, 'rb') as fp: - self.assertNotIn('#-- START BLOCK 2'+"\n"+new_content+"\n"+'#-- END BLOCK 2', fp.read()) + self.assertNotIn('#-- START BLOCK 2' + + "\n" + new_content + "\n" + + '#-- END BLOCK 2', fp.read()) - filemod.blockreplace(self.tfile.name, '#-- START BLOCK 2', '#-- END BLOCK 2', new_content, backup=False, append_if_not_found=True) + filemod.blockreplace(self.tfile.name, + '#-- START BLOCK 2', + '#-- END BLOCK 2', + new_content, + backup=False, + append_if_not_found=True) with open(self.tfile.name, 'rb') as fp: - self.assertIn('#-- START BLOCK 2'+"\n"+new_content+"\n"+'#-- END BLOCK 2', fp.read()) + self.assertIn('#-- START BLOCK 2' + + "\n" + new_content + + "\n" + '#-- END BLOCK 2', fp.read()) def test_replace_prepend(self): new_content = "Well, I didn't vote for you." @@ -190,15 +216,30 @@ class FileBlockReplaceTestCase(TestCase): backup=False ) with open(self.tfile.name, 'rb') as fp: - self.assertNotIn('#-- START BLOCK 2'+"\n"+new_content+"\n"+'#-- END BLOCK 2', fp.read()) + self.assertNotIn( + '#-- START BLOCK 2' + "\n" + + new_content + "\n" + '#-- END BLOCK 2', + fp.read()) - filemod.blockreplace(self.tfile.name, '#-- START BLOCK 2', '#-- END BLOCK 2', new_content, backup=False, prepend_if_not_found=True) + filemod.blockreplace(self.tfile.name, + '#-- START BLOCK 2', '#-- END BLOCK 2', + new_content, + backup=False, + prepend_if_not_found=True) with open(self.tfile.name, 'rb') as fp: - self.assertTrue(fp.read().startswith('#-- START BLOCK 2'+"\n"+new_content+"\n"+'#-- END BLOCK 2')) + self.assertTrue( + fp.read().startswith( + '#-- START BLOCK 2' + + "\n" + new_content + + "\n" + '#-- END BLOCK 2')) def test_replace_partial_marked_lines(self): - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 1', backup=False) + filemod.blockreplace(self.tfile.name, + '// START BLOCK', + '// END BLOCK', + 'new content 1', + backup=False) with open(self.tfile.name, 'rb') as fp: filecontent = fp.read() @@ -213,7 +254,10 @@ class FileBlockReplaceTestCase(TestCase): fext = '.bak' bak_file = '{0}{1}'.format(self.tfile.name, fext) - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 2', backup=fext) + filemod.blockreplace( + self.tfile.name, + '// START BLOCK', '// END BLOCK', 'new content 2', + backup=fext) self.assertTrue(os.path.exists(bak_file)) os.unlink(bak_file) @@ -222,31 +266,54 @@ class FileBlockReplaceTestCase(TestCase): fext = '.bak' bak_file = '{0}{1}'.format(self.tfile.name, fext) - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 3', backup=False) + filemod.blockreplace(self.tfile.name, + '// START BLOCK', '// END BLOCK', 'new content 3', + backup=False) self.assertFalse(os.path.exists(bak_file)) def test_no_modifications(self): - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 4', backup=False) + filemod.blockreplace(self.tfile.name, + '// START BLOCK', '// END BLOCK', + 'new content 4', + backup=False) before_ctime = os.stat(self.tfile.name).st_mtime - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 4', backup=False) + filemod.blockreplace(self.tfile.name, + '// START BLOCK', + '// END BLOCK', + 'new content 4', + backup=False) after_ctime = os.stat(self.tfile.name).st_mtime self.assertEqual(before_ctime, after_ctime) def test_dry_run(self): before_ctime = os.stat(self.tfile.name).st_mtime - filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 5', dry_run=True) + filemod.blockreplace(self.tfile.name, + '// START BLOCK', + '// END BLOCK', + 'new content 5', + dry_run=True) after_ctime = os.stat(self.tfile.name).st_mtime self.assertEqual(before_ctime, after_ctime) def test_show_changes(self): - ret = filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 6', backup=False, show_changes=True) + ret = filemod.blockreplace(self.tfile.name, + '// START BLOCK', + '// END BLOCK', + 'new content 6', + backup=False, + show_changes=True) self.assertTrue(ret.startswith('---')) # looks like a diff - ret = filemod.blockreplace(self.tfile.name, '// START BLOCK', '// END BLOCK', 'new content 7', backup=False, show_changes=False) + ret = filemod.blockreplace(self.tfile.name, + '// START BLOCK', + '// END BLOCK', + 'new content 7', + backup=False, + show_changes=False) self.assertIsInstance(ret, bool) @@ -258,7 +325,7 @@ class FileBlockReplaceTestCase(TestCase): '#-- START BLOCK UNFINISHED', '#-- END BLOCK UNFINISHED', 'foobar', - backup=False + backup=False ) @@ -309,4 +376,7 @@ class FileModuleTestCase(TestCase): if __name__ == '__main__': from integration import run_tests - run_tests(FileModuleTestCase, FileReplaceTestCase, FileBlockReplaceTestCase, needs_daemon=False) + run_tests(FileModuleTestCase, + FileReplaceTestCase, + FileBlockReplaceTestCase, + needs_daemon=False) diff --git a/tests/unit/modules/zcbuildout_test.py b/tests/unit/modules/zcbuildout_test.py index d43beed3bc..665681a237 100644 --- a/tests/unit/modules/zcbuildout_test.py +++ b/tests/unit/modules/zcbuildout_test.py @@ -4,9 +4,6 @@ import os import tempfile import urllib2 -import textwrap - -from distutils.dir_util import copy_tree # Import Salt Testing libs from salttesting import TestCase @@ -14,7 +11,6 @@ from salttesting.helpers import ( ensure_in_syspath, requires_network, ) -from salttesting.mock import MagicMock ensure_in_syspath('../../') import integration @@ -23,7 +19,6 @@ import shutil # Import Salt libs from salt.modules import zcbuildout as buildout from salt.modules import cmdmod as cmd -from salt.exceptions import CommandExecutionError, SaltInvocationError ROOT = os.path.join(integration.FILES, 'file', 'base', 'buildout') @@ -106,6 +101,7 @@ class BuildoutTestCase(Base): @buildout._salt_callback def callback2(a, b=1): raise Exception('foo') + return 1 # make pylint happy ret1 = callback1(1, b=3) self.assertEqual(ret1['status'], True) diff --git a/tests/unit/states/zcbuildout_test.py b/tests/unit/states/zcbuildout_test.py index 6e6f666712..a88ec94978 100644 --- a/tests/unit/states/zcbuildout_test.py +++ b/tests/unit/states/zcbuildout_test.py @@ -77,16 +77,16 @@ class BuildoutTestCase(Base): def test_installed(self): b_dir = os.path.join(self.tdir, 'b') ret = buildout.installed(b_dir, onlyif='/bin/false') - self.assertEqual(ret['comment'], '\nonlyif execution failed') - self.assertEqual(ret['result'], True) + self.assertEqual(ret['comment'], '\nonlyif execution failed') + self.assertEqual(ret['result'], True) self.assertTrue('/b' in ret['name']) b_dir = os.path.join(self.tdir, 'b') ret = buildout.installed(b_dir, unless='/bin/true') - self.assertEqual(ret['comment'], '\nunless execution succeeded') - self.assertEqual(ret['result'], True) + self.assertEqual(ret['comment'], '\nunless execution succeeded') + self.assertEqual(ret['result'], True) self.assertTrue('/b' in ret['name']) ret = buildout.installed(b_dir) - self.assertEqual(ret['result'], True) + self.assertEqual(ret['result'], True) self.assertTrue('OUTPUT:' in ret['comment']) self.assertTrue('Log summary:' in ret['comment']) From 7d299f9c0fd289b20ed805bcd84bb22a84eeb123 Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Tue, 3 Dec 2013 23:21:02 +0000 Subject: [PATCH 2/2] pylint fixes --- salt/modules/dockerio.py | 2 +- tests/unit/states/zcbuildout_test.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/salt/modules/dockerio.py b/salt/modules/dockerio.py index cd2193ec71..9e2041847e 100644 --- a/salt/modules/dockerio.py +++ b/salt/modules/dockerio.py @@ -1146,7 +1146,7 @@ def login(url=None, username=None, password=None, email=None, *args, **kwargs): salt '*' docker.login ''' client = _get_client() - return client.login(url, username=username, password=password, email=email) + return client.login(url, username, password, email) def search(term, *args, **kwargs): diff --git a/tests/unit/states/zcbuildout_test.py b/tests/unit/states/zcbuildout_test.py index a88ec94978..6f2373e6b6 100644 --- a/tests/unit/states/zcbuildout_test.py +++ b/tests/unit/states/zcbuildout_test.py @@ -3,8 +3,6 @@ import os import tempfile import textwrap -from distutils.dir_util import copy_tree - # Import third party libs import yaml