[oe-commits] [bitbake] 08/17: toaster: raise NotImplementedError
git at git.openembedded.org
git at git.openembedded.org
Mon Mar 7 17:24:00 UTC 2016
rpurdie pushed a commit to branch master
in repository bitbake.
commit c243ab6c83fe12d84777e4c3a18fd393827b9327
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Wed Mar 2 21:26:54 2016 -0800
toaster: raise NotImplementedError
Raised NotImplementedError instead of Exception to be
able to catch it.
This is a preparation for removing sshbecontroller module.
It has to be done as code in bldcontrol/tests.py imports custom
NotImplementedException from sshbecontroller.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: brian avery <avery.brian at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/toaster/bldcontrol/bbcontroller.py | 10 +++++-----
lib/toaster/bldcontrol/models.py | 8 ++++++--
lib/toaster/bldcontrol/tests.py | 6 ++----
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/lib/toaster/bldcontrol/bbcontroller.py b/lib/toaster/bldcontrol/bbcontroller.py
index 1387bda..f228d37 100644
--- a/lib/toaster/bldcontrol/bbcontroller.py
+++ b/lib/toaster/bldcontrol/bbcontroller.py
@@ -138,7 +138,7 @@ class BuildEnvironmentController(object):
After this method executes, self.be bbaddress/bbport MUST point to a running and free server,
and the bbstate MUST be updated to "started".
"""
- raise Exception("FIXME: Must override in order to actually start the BB server")
+ raise NotImplementedError("FIXME: Must override in order to actually start the BB server")
def setLayers(self, bitbake, ls):
@@ -149,7 +149,7 @@ class BuildEnvironmentController(object):
a word of attention: by convention, the first layer for any build will be poky!
"""
- raise Exception("FIXME: Must override setLayers")
+ raise NotImplementedError("FIXME: Must override setLayers")
def getBBController(self):
@@ -176,16 +176,16 @@ class BuildEnvironmentController(object):
up to the implementing BEC. The return MUST be a REST URL where a GET will actually return
the content of the artifact, e.g. for use as a "download link" in a web UI.
"""
- raise Exception("Must return the REST URL of the artifact")
+ raise NotImplementedError("Must return the REST URL of the artifact")
def release(self):
""" This stops the server and releases any resources. After this point, all resources
are un-available for further reference
"""
- raise Exception("Must override BE release")
+ raise NotImplementedError("Must override BE release")
def triggerBuild(self, bitbake, layers, variables, targets):
- raise Exception("Must override BE release")
+ raise NotImplementedError("Must override BE release")
class ShellCmdException(Exception):
pass
diff --git a/lib/toaster/bldcontrol/models.py b/lib/toaster/bldcontrol/models.py
index a3a49ce..bb613c6 100644
--- a/lib/toaster/bldcontrol/models.py
+++ b/lib/toaster/bldcontrol/models.py
@@ -42,13 +42,17 @@ class BuildEnvironment(models.Model):
def get_artifact(self, path):
if self.betype == BuildEnvironment.TYPE_LOCAL:
return open(path, "r")
- raise Exception("FIXME: artifact download not implemented for build environment type %s" % self.get_betype_display())
+ raise NotImplementedError("FIXME: artifact download not implemented "\
+ "for build environment type %s" % \
+ self.get_betype_display())
def has_artifact(self, path):
import os
if self.betype == BuildEnvironment.TYPE_LOCAL:
return os.path.exists(path)
- raise Exception("FIXME: has artifact not implemented for build environment type %s" % self.get_betype_display())
+ raise NotImplementedError("FIXME: has artifact not implemented for "\
+ "build environment type %s" % \
+ self.get_betype_display())
# a BuildRequest is a request that the scheduler will build using a BuildEnvironment
# the build request queue is the table itself, ordered by state
diff --git a/lib/toaster/bldcontrol/tests.py b/lib/toaster/bldcontrol/tests.py
index 141b42a..e808991 100644
--- a/lib/toaster/bldcontrol/tests.py
+++ b/lib/toaster/bldcontrol/tests.py
@@ -48,13 +48,12 @@ class BEControllerTests(object):
self.assertTrue(err == '', "bitbake server pid %s not stopped" % err)
def test_serverStartAndStop(self):
- from bldcontrol.sshbecontroller import NotImplementedException
obe = self._getBuildEnvironment()
bc = self._getBEController(obe)
try:
# setting layers, skip any layer info
bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
- except NotImplementedException, e:
+ except NotImplementedError:
print "Test skipped due to command not implemented yet"
return True
# We are ok with the exception as we're handling the git already exists
@@ -74,14 +73,13 @@ class BEControllerTests(object):
self._serverForceStop(bc)
def test_getBBController(self):
- from bldcontrol.sshbecontroller import NotImplementedException
obe = self._getBuildEnvironment()
bc = self._getBEController(obe)
layerSet = False
try:
# setting layers, skip any layer info
layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
- except NotImplementedException:
+ except NotImplementedError:
print "Test skipped due to command not implemented yet"
return True
# We are ok with the exception as we're handling the git already exists
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list