summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSorin Sbarnea <ssbarnea@redhat.com>2018-06-19 17:23:22 +0100
committerSorin Sbarnea <ssbarnea@redhat.com>2018-06-19 18:04:37 +0100
commit4f7b6ee568f9702d6d1b974f0490d8dcd0092cfc (patch)
tree5fe08b2276d5aed2d8e5f9033b4382d03c1c8ace
parentc337c5fa75596f59f467b93eab29725ae10caee6 (diff)
downloadpython-jenkins-job-builder-4f7b6ee568f9702d6d1b974f0490d8dcd0092cfc.tar.gz
python-jenkins-job-builder-4f7b6ee568f9702d6d1b974f0490d8dcd0092cfc.tar.xz
python-jenkins-job-builder-4f7b6ee568f9702d6d1b974f0490d8dcd0092cfc.zip
upgrade hacking module
- upgrades hacking to current version - sorts new linting issues - sorts bug with sys.reload on py3 Change-Id: I4a18abc93116667a2733e8aec619ac59ea73d630 Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
-rw-r--r--jenkins_jobs/cli/entry.py4
-rw-r--r--jenkins_jobs/local_yaml.py2
-rw-r--r--jenkins_jobs/modules/parameters.py4
-rw-r--r--jenkins_jobs/modules/project_matrix.py4
-rw-r--r--jenkins_jobs/modules/publishers.py16
-rw-r--r--jenkins_jobs/modules/triggers.py10
-rw-r--r--jenkins_jobs/modules/zuul.py2
-rw-r--r--jenkins_jobs/parser.py4
-rw-r--r--test-requirements.txt2
-rw-r--r--tests/cmd/subcommands/test_test.py2
10 files changed, 27 insertions, 23 deletions
diff --git a/jenkins_jobs/cli/entry.py b/jenkins_jobs/cli/entry.py
index 7ba9618b..484b7a3d 100644
--- a/jenkins_jobs/cli/entry.py
+++ b/jenkins_jobs/cli/entry.py
@@ -17,6 +17,7 @@ import io
import os
import logging
import platform
+import sys
from stevedore import extension
import yaml
@@ -26,6 +27,9 @@ from jenkins_jobs.config import JJBConfig
from jenkins_jobs import utils
from jenkins_jobs import version
+if sys.version_info[0] != 2:
+ from importlib import reload
+
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
diff --git a/jenkins_jobs/local_yaml.py b/jenkins_jobs/local_yaml.py
index a55587b9..3af772f2 100644
--- a/jenkins_jobs/local_yaml.py
+++ b/jenkins_jobs/local_yaml.py
@@ -417,7 +417,7 @@ class YamlInclude(BaseYAMLObject):
try:
with io.open(filename, 'r', encoding='utf-8') as f:
return f.read()
- except:
+ except Exception:
logger.error("Failed to include file using search path: '{0}'"
.format(':'.join(loader.search_path)))
raise
diff --git a/jenkins_jobs/modules/parameters.py b/jenkins_jobs/modules/parameters.py
index 95732061..f475546b 100644
--- a/jenkins_jobs/modules/parameters.py
+++ b/jenkins_jobs/modules/parameters.py
@@ -668,8 +668,8 @@ def dynamic_string_scriptler_param(registry, xml_parent, data):
def dynamic_param_common(registry, xml_parent, data, ptype):
pdef = base_param(registry, xml_parent, data, False,
- 'com.seitenbau.jenkins.plugins.dynamicparameter.'
- + ptype)
+ 'com.seitenbau.jenkins.plugins.dynamicparameter.' +
+ ptype)
XML.SubElement(pdef, '__remote').text = str(
data.get('remote', False)).lower()
XML.SubElement(pdef, '__script').text = data.get('script', None)
diff --git a/jenkins_jobs/modules/project_matrix.py b/jenkins_jobs/modules/project_matrix.py
index 89633e75..a96b7f00 100644
--- a/jenkins_jobs/modules/project_matrix.py
+++ b/jenkins_jobs/modules/project_matrix.py
@@ -136,8 +136,8 @@ class Matrix(jenkins_jobs.modules.base.Base):
root = XML.Element('matrix-project')
# Default to 'execution-strategy'
- strategies = ([s for s in data.keys() if s.endswith('-strategy')]
- or ['execution-strategy'])
+ strategies = ([s for s in data.keys() if s.endswith('-strategy')] or
+ ['execution-strategy'])
# Job can not have multiple strategies
if len(strategies) > 1:
diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py
index 0fbfad9a..1da0e095 100644
--- a/jenkins_jobs/modules/publishers.py
+++ b/jenkins_jobs/modules/publishers.py
@@ -656,8 +656,8 @@ def clone_workspace(registry, xml_parent, data):
if 'criteria' in data and criteria not in criteria_list:
raise JenkinsJobsException(
- 'clone-workspace criteria must be one of: '
- + ', '.join(criteria_list))
+ 'clone-workspace criteria must be one of: ' +
+ ', '.join(criteria_list))
else:
XML.SubElement(cloneworkspace, 'criteria').text = criteria
@@ -667,8 +667,8 @@ def clone_workspace(registry, xml_parent, data):
if 'archive-method' in data and archive_method not in archive_list:
raise JenkinsJobsException(
- 'clone-workspace archive-method must be one of: '
- + ', '.join(archive_list))
+ 'clone-workspace archive-method must be one of: ' +
+ ', '.join(archive_list))
else:
XML.SubElement(cloneworkspace, 'archiveMethod').text = archive_method
@@ -2083,8 +2083,8 @@ def claim_build(registry, xml_parent, data):
def base_email_ext(registry, xml_parent, data, ttype):
trigger = XML.SubElement(xml_parent,
- 'hudson.plugins.emailext.plugins.trigger.'
- + ttype)
+ 'hudson.plugins.emailext.plugins.trigger.' +
+ ttype)
email = XML.SubElement(trigger, 'email')
XML.SubElement(email, 'recipientList').text = ''
XML.SubElement(email, 'subject').text = '$PROJECT_DEFAULT_SUBJECT'
@@ -4033,8 +4033,8 @@ def postbuildscript(registry, xml_parent, data):
for shell_script in script_data:
script_xml = XML.SubElement(
scripts_xml,
- 'org.jenkinsci.plugins.postbuildscript.'
- + script_types[step])
+ 'org.jenkinsci.plugins.postbuildscript.' +
+ script_types[step])
file_path_xml = XML.SubElement(script_xml, 'filePath')
file_path_xml.text = shell_script
diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py
index fca9bfbf..1fd24e6e 100644
--- a/jenkins_jobs/modules/triggers.py
+++ b/jenkins_jobs/modules/triggers.py
@@ -153,9 +153,9 @@ def build_gerrit_triggers(xml_parent, data):
"format instead.", event)
if not tag_name:
- known = ', '.join(available_simple_triggers.keys()
- + ['comment-added-event',
- 'comment-added-contains-event'])
+ known = ', '.join(available_simple_triggers.keys() +
+ ['comment-added-event',
+ 'comment-added-contains-event'])
msg = ("The event '%s' under 'trigger-on' is not one of the "
"known: %s.") % (event, known)
raise JenkinsJobsException(msg)
@@ -880,8 +880,8 @@ def jms_messaging(registry, xml_parent, data):
if len(checks) > 0:
msgchecks = XML.SubElement(jmsm, 'checks')
for check in checks:
- msgcheck = XML.SubElement(msgchecks, namespace
- + 'messaging.checks.MsgCheck')
+ msgcheck = XML.SubElement(msgchecks, namespace +
+ 'messaging.checks.MsgCheck')
mapping = [
('field', 'field', ''),
('expected-value', 'expectedValue', '')]
diff --git a/jenkins_jobs/modules/zuul.py b/jenkins_jobs/modules/zuul.py
index 224412ae..c4f4857a 100644
--- a/jenkins_jobs/modules/zuul.py
+++ b/jenkins_jobs/modules/zuul.py
@@ -21,6 +21,7 @@ http://docs.openstack.org/infra/zuul/launchers.html#zuul-parameters
"""
import itertools
+import jenkins_jobs.modules.base
def zuul():
@@ -55,7 +56,6 @@ def zuul_post():
- zuul-post
"""
-import jenkins_jobs.modules.base
ZUUL_PARAMETERS = [
{'string':
diff --git a/jenkins_jobs/parser.py b/jenkins_jobs/parser.py
index 8be0823a..f1b67c06 100644
--- a/jenkins_jobs/parser.py
+++ b/jenkins_jobs/parser.py
@@ -99,8 +99,8 @@ class YamlParser(object):
if not hasattr(path, 'read') and os.path.isdir(path):
files_to_process.extend([os.path.join(path, f)
for f in sorted(os.listdir(path))
- if (f.endswith('.yml')
- or f.endswith('.yaml'))])
+ if (f.endswith('.yml') or
+ f.endswith('.yaml'))])
else:
files_to_process.append(path)
diff --git a/test-requirements.txt b/test-requirements.txt
index 21866f2c..0869b2c4 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-hacking<0.13,>=0.12.0 # Apache-2.0
+hacking>=1.1.0 # Apache-2.0
coverage>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
diff --git a/tests/cmd/subcommands/test_test.py b/tests/cmd/subcommands/test_test.py
index 78403ffa..0ac06d4a 100644
--- a/tests/cmd/subcommands/test_test.py
+++ b/tests/cmd/subcommands/test_test.py
@@ -251,7 +251,7 @@ class TestJenkinsGetPluginInfoError(CmdTestsBase):
self.execute_jenkins_jobs_with_args(args)
except jenkins.JenkinsException:
self.fail("jenkins.JenkinsException propagated to main")
- except:
+ except Exception:
pass # only care about jenkins.JenkinsException for now
@mock.patch('jenkins.Jenkins.get_plugins')