From: Hugh Brown Date: Fri, 11 Oct 2013 00:04:44 +0000 (-0400) Subject: Rename exceptions to custom_exceptions (because exceptions screws up pylint) X-Git-Tag: v0.2.23~92^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=210f4acefe8f79a60b649c92e1d90bf5e3e0fef0;p=tools%2Fpython-jenkinsapi.git Rename exceptions to custom_exceptions (because exceptions screws up pylint) --- diff --git a/jenkinsapi/__init__.py b/jenkinsapi/__init__.py index 5e9bac3..f6810da 100644 --- a/jenkinsapi/__init__.py +++ b/jenkinsapi/__init__.py @@ -52,13 +52,13 @@ from jenkinsapi import ( utils, # Files - api, artifact, build, config, constants, exceptions, fingerprint, + api, artifact, build, config, constants, custom_exceptions, fingerprint, jenkins, jenkinsbase, job, node, result_set, result, view ) __all__ = [ "command_line", "utils", - "api", "artifact", "build", "config", "constants", "exceptions", "fingerprint", + "api", "artifact", "build", "config", "constants", "custom_exceptions", "fingerprint", "jenkins", "jenkinsbase", "job", "node", "result_set", "result", "view" ] __docformat__ = "epytext" diff --git a/jenkinsapi/api.py b/jenkinsapi/api.py index 53efb77..108b567 100644 --- a/jenkinsapi/api.py +++ b/jenkinsapi/api.py @@ -10,7 +10,7 @@ from urllib2 import urlparse from jenkinsapi import constants from jenkinsapi.jenkins import Jenkins from jenkinsapi.artifact import Artifact -from jenkinsapi.exceptions import ArtifactsMissing, TimeOut, BadURL +from jenkinsapi.custom_exceptions import ArtifactsMissing, TimeOut, BadURL log = logging.getLogger(__name__) diff --git a/jenkinsapi/artifact.py b/jenkinsapi/artifact.py index 4ac0acf..b84dac9 100644 --- a/jenkinsapi/artifact.py +++ b/jenkinsapi/artifact.py @@ -12,7 +12,7 @@ import logging import hashlib from jenkinsapi.fingerprint import Fingerprint -from jenkinsapi.exceptions import ArtifactBroken +from jenkinsapi.custom_exceptions import ArtifactBroken log = logging.getLogger(__name__) diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index f18427c..3088555 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -8,7 +8,7 @@ import datetime from jenkinsapi.artifact import Artifact from jenkinsapi import config from jenkinsapi.jenkinsbase import JenkinsBase -from jenkinsapi.exceptions import NoResults +from jenkinsapi.custom_exceptions import NoResults from jenkinsapi.constants import STATUS_SUCCESS from jenkinsapi.result_set import ResultSet diff --git a/jenkinsapi/custom_exceptions.py b/jenkinsapi/custom_exceptions.py new file mode 100644 index 0000000..bb88d56 --- /dev/null +++ b/jenkinsapi/custom_exceptions.py @@ -0,0 +1,127 @@ +""" +Module for custom_exceptions specialized for jenkinsapi +""" + + +class JenkinsAPIException(Exception): + """ + Base class for all errors + """ + pass + +class NotFound(JenkinsAPIException): + """ + Resource cannot be found + """ + pass + + +class ArtifactsMissing(NotFound): + """ + Cannot find a build with all of the required artifacts. + """ + pass + + +class UnknownJob(KeyError, NotFound): + """ + Jenkins does not recognize the job requested. + """ + pass + + +class UnknownView(KeyError, NotFound): + """ + Jenkins does not recognize the view requested. + """ + pass + + +class UnknownNode(KeyError, NotFound): + """ + Jenkins does not recognize the node requested. + """ + pass + + +class UnknownQueueItem(KeyError, NotFound): + """ + Jenkins does not recognize the requested queue item + """ + pass + + +class NoBuildData(NotFound): + """ + A job has no build data. + """ + pass + + +class ArtifactBroken(JenkinsAPIException): + """ + An artifact is broken, wrong + """ + pass + + +class TimeOut(JenkinsAPIException): + """ + Some jobs have taken too long to complete. + """ + pass + + +class WillNotBuild(JenkinsAPIException): + """ + Cannot trigger a new build. + """ + pass + + +class NoResults(JenkinsAPIException): + """ + A build did not publish any results. + """ + pass + + +class FailedNoResults(NoResults): + """ + A build did not publish any results because it failed + """ + pass + + +class BadURL(ValueError, JenkinsAPIException): + """ + A URL appears to be broken + """ + pass + + +class NotAuthorized(JenkinsAPIException): + """Not Authorized to access resource""" + # Usually thrown when we get a 403 returned + pass + + +class NotSupportSCM(JenkinsAPIException): + """ + It's a SCM that does not supported by current version of jenkinsapi + """ + pass + + +class NotConfiguredSCM(JenkinsAPIException): + """ + It's a job that doesn't have configured SCM + """ + pass + + +class NotInQueue(JenkinsAPIException): + """ + It's a job that is not in the queue + """ + pass diff --git a/jenkinsapi/exceptions.py b/jenkinsapi/exceptions.py deleted file mode 100644 index 48539cc..0000000 --- a/jenkinsapi/exceptions.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -Module for exceptions specialized for jenkinsapi -""" - - -class JenkinsAPIException(Exception): - """ - Base class for all errors - """ - - -class NotFound(JenkinsAPIException): - """ - Resource cannot be found - """ - - -class ArtifactsMissing(NotFound): - """ - Cannot find a build with all of the required artifacts. - """ - - -class UnknownJob(KeyError, NotFound): - """ - Jenkins does not recognize the job requested. - """ - - -class UnknownView(KeyError, NotFound): - """ - Jenkins does not recognize the view requested. - """ - - -class UnknownNode(KeyError, NotFound): - """ - Jenkins does not recognize the node requested. - """ - - -class UnknownQueueItem(KeyError, NotFound): - """ - Jenkins does not recognize the requested queue item - """ - - -class NoBuildData(NotFound): - """ - A job has no build data. - """ - - -class ArtifactBroken(JenkinsAPIException): - """ - An artifact is broken, wrong - """ - - -class TimeOut(JenkinsAPIException): - """ - Some jobs have taken too long to complete. - """ - - -class WillNotBuild(JenkinsAPIException): - """ - Cannot trigger a new build. - """ - - -class NoResults(JenkinsAPIException): - """ - A build did not publish any results. - """ - - -class FailedNoResults(NoResults): - """ - A build did not publish any results because it failed - """ - - -class BadURL(ValueError, JenkinsAPIException): - """ - A URL appears to be broken - """ - - -class NotAuthorized(JenkinsAPIException): - """Not Authorized to access resource""" - # Usually thrown when we get a 403 returned - - -class NotSupportSCM(JenkinsAPIException): - """ - It's a SCM that does not supported by current version of jenkinsapi - """ - - -class NotConfiguredSCM(JenkinsAPIException): - """ - It's a job that doesn't have configured SCM - """ - - -class NotInQueue(JenkinsAPIException): - """ - It's a job that is not in the queue - """ diff --git a/jenkinsapi/fingerprint.py b/jenkinsapi/fingerprint.py index 050dd08..9a98914 100644 --- a/jenkinsapi/fingerprint.py +++ b/jenkinsapi/fingerprint.py @@ -3,7 +3,7 @@ Module for jenkinsapi Fingerprint """ from jenkinsapi.jenkinsbase import JenkinsBase -from jenkinsapi.exceptions import ArtifactBroken +from jenkinsapi.custom_exceptions import ArtifactBroken import urllib2 import re diff --git a/jenkinsapi/invocation.py b/jenkinsapi/invocation.py index 3ff2eb1..cfcf992 100644 --- a/jenkinsapi/invocation.py +++ b/jenkinsapi/invocation.py @@ -4,7 +4,7 @@ Module for Jenkinsapi Invocation object import time import datetime -from jenkinsapi.exceptions import UnknownQueueItem, TimeOut +from jenkinsapi.custom_exceptions import UnknownQueueItem, TimeOut class Invocation(object): diff --git a/jenkinsapi/jenkins.py b/jenkinsapi/jenkins.py index 324335d..0e382f5 100644 --- a/jenkinsapi/jenkins.py +++ b/jenkinsapi/jenkins.py @@ -19,7 +19,7 @@ from jenkinsapi.queue import Queue from jenkinsapi.fingerprint import Fingerprint from jenkinsapi.jenkinsbase import JenkinsBase from jenkinsapi.utils.requester import Requester -from jenkinsapi.exceptions import UnknownJob, JenkinsAPIException +from jenkinsapi.custom_exceptions import UnknownJob, JenkinsAPIException log = logging.getLogger(__name__) diff --git a/jenkinsapi/jenkinsbase.py b/jenkinsapi/jenkinsbase.py index 5fd59ab..00840c9 100644 --- a/jenkinsapi/jenkinsbase.py +++ b/jenkinsapi/jenkinsbase.py @@ -4,7 +4,7 @@ Module for JenkinsBase class import logging from jenkinsapi import config -from jenkinsapi.exceptions import JenkinsAPIException +from jenkinsapi.custom_exceptions import JenkinsAPIException log = logging.getLogger(__name__) diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py index 73faa4b..3f4215b 100644 --- a/jenkinsapi/job.py +++ b/jenkinsapi/job.py @@ -13,7 +13,7 @@ from jenkinsapi.invocation import Invocation from jenkinsapi.jenkinsbase import JenkinsBase from jenkinsapi.queue import QueueItem from jenkinsapi.mutable_jenkins_thing import MutableJenkinsThing -from jenkinsapi.exceptions import ( +from jenkinsapi.custom_exceptions import ( NoBuildData, NotConfiguredSCM, NotFound, diff --git a/jenkinsapi/nodes.py b/jenkinsapi/nodes.py index d3ec02b..82fbe70 100644 --- a/jenkinsapi/nodes.py +++ b/jenkinsapi/nodes.py @@ -4,7 +4,7 @@ Module for jenkinsapi nodes import logging from jenkinsapi.node import Node -from jenkinsapi.exceptions import UnknownNode +from jenkinsapi.custom_exceptions import UnknownNode from jenkinsapi.jenkinsbase import JenkinsBase log = logging.getLogger(__name__) diff --git a/jenkinsapi/queue.py b/jenkinsapi/queue.py index e6fda7c..92f0d60 100644 --- a/jenkinsapi/queue.py +++ b/jenkinsapi/queue.py @@ -3,7 +3,7 @@ Queue module for jenkinsapi """ from jenkinsapi.jenkinsbase import JenkinsBase -from jenkinsapi.exceptions import UnknownQueueItem +from jenkinsapi.custom_exceptions import UnknownQueueItem import logging log = logging.getLogger(__name__)