Suppress some Coverage report output

We are not responsible for marconi.openstack.common code so it
will be excluded from our Coverage report. Also excluding
NotImplementedErrors as there's obviously no implementation in
that case to be tested.

Change-Id: Ie1e2cf4b858afef56ffed7ee225a0f8c29dcaef8
This commit is contained in:
Bryan Davidson 2013-03-25 16:59:25 -04:00 committed by Zhihao Yuan
parent e3e4c0073b
commit 54f21769d7
9 changed files with 36 additions and 29 deletions

View File

@ -1,6 +1,8 @@
[run] [run]
branch = True branch = True
omit = /usr*,setup.py,*egg*,.venv/*,.tox/*,marconi/tests/* omit = *marconi/openstack*
[report] [report]
ignore-errors = True exclude_lines =
if __MARCONI_SETUP__:
raise NotImplementedError

View File

@ -15,15 +15,14 @@
# Import guard. No module level import during the setup procedure. # Import guard. No module level import during the setup procedure.
try: try:
__MARCONI_SETUP__ # NOQA if __MARCONI_SETUP__:
import sys as _sys
_sys.stderr.write('Running from marconi source directory.\n')
del _sys
except NameError: except NameError:
import gettext import gettext
gettext.install("marconi", unicode=1) gettext.install("marconi", unicode=1)
from marconi.bootstrap import Bootstrap # NOQA from marconi.bootstrap import Bootstrap # NOQA
else:
import sys as _sys
_sys.stderr.write('Running from marconi source directory.\n')
del _sys
import marconi.version import marconi.version

View File

@ -32,21 +32,21 @@ class DriverBase:
""" """
Returns storage's queues controller Returns storage's queues controller
""" """
pass raise NotImplementedError
@abc.abstractproperty @abc.abstractproperty
def message_controller(self): def message_controller(self):
""" """
Returns storage's messages controller Returns storage's messages controller
""" """
pass raise NotImplementedError
@abc.abstractproperty @abc.abstractproperty
def claim_controller(self): def claim_controller(self):
""" """
Returns storage's claims controller Returns storage's claims controller
""" """
pass raise NotImplementedError
class ControllerBase(object): class ControllerBase(object):
@ -83,7 +83,7 @@ class QueueBase(ControllerBase):
:returns: List of queues :returns: List of queues
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def get(self, name, tenant=None): def get(self, name, tenant=None):
@ -96,7 +96,7 @@ class QueueBase(ControllerBase):
:returns: Dictionary containing queue metadata :returns: Dictionary containing queue metadata
:raises: DoesNotExist :raises: DoesNotExist
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def upsert(self, name, metadata, tenant=None): def upsert(self, name, metadata, tenant=None):
@ -121,7 +121,7 @@ class QueueBase(ControllerBase):
:param name: The queue name :param name: The queue name
:param tenant: Tenant id :param tenant: Tenant id
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def stats(self, name, tenant=None): def stats(self, name, tenant=None):
@ -133,7 +133,7 @@ class QueueBase(ControllerBase):
:returns: Dictionary with the :returns: Dictionary with the
queue stats queue stats
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def actions(self, name, tenant=None, marker=None, limit=10): def actions(self, name, tenant=None, marker=None, limit=10):
@ -146,7 +146,7 @@ class QueueBase(ControllerBase):
:param limit: (Default 10) Max number :param limit: (Default 10) Max number
of messages to retrieve. of messages to retrieve.
""" """
pass raise NotImplementedError
class MessageBase(ControllerBase): class MessageBase(ControllerBase):
@ -181,7 +181,7 @@ class MessageBase(ControllerBase):
:returns: List of messages :returns: List of messages
:raises: DoesNotExist :raises: DoesNotExist
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def post(self, queue, messages, tenant=None): def post(self, queue, messages, tenant=None):
@ -199,7 +199,7 @@ class MessageBase(ControllerBase):
:returns: List of message ids :returns: List of message ids
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def delete(self, queue, message_id, tenant=None, claim=None): def delete(self, queue, message_id, tenant=None, claim=None):
@ -215,7 +215,7 @@ class MessageBase(ControllerBase):
be valid and message_id must belong to be valid and message_id must belong to
it. it.
""" """
pass raise NotImplementedError
class ClaimBase(ControllerBase): class ClaimBase(ControllerBase):
@ -236,7 +236,7 @@ class ClaimBase(ControllerBase):
metadata and claimed messages. metadata and claimed messages.
:raises: DoesNotExist :raises: DoesNotExist
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def create(self, queue, tenant=None, ttl=MIN_TTL, limit=10): def create(self, queue, tenant=None, ttl=MIN_TTL, limit=10):
@ -254,7 +254,7 @@ class ClaimBase(ControllerBase):
:returns: Dictionary containing claim's :returns: Dictionary containing claim's
metadata and claimed messages. metadata and claimed messages.
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def update(self, queue, claim_id, tenant=None, **metadata): def update(self, queue, claim_id, tenant=None, **metadata):
@ -268,7 +268,7 @@ class ClaimBase(ControllerBase):
:param metadata: Claim's parameters :param metadata: Claim's parameters
to be updated. to be updated.
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def delete(self, queue, claim_id, tenant=None): def delete(self, queue, claim_id, tenant=None):
@ -280,7 +280,7 @@ class ClaimBase(ControllerBase):
:param claim_id: Claim to be deleted :param claim_id: Claim to be deleted
:param tenant: Tenant id :param tenant: Tenant id
""" """
pass raise NotImplementedError
@abc.abstractmethod @abc.abstractmethod
def stats(self, queue, claim_id, tenant=None): def stats(self, queue, claim_id, tenant=None):
@ -294,4 +294,4 @@ class ClaimBase(ControllerBase):
:returns: Dictionary with the :returns: Dictionary with the
queue stats queue stats
""" """
pass raise NotImplementedError

View File

@ -82,7 +82,7 @@ class QueueController(storage.QueueBase):
self._col.remove({"t": tenant, "n": name}) self._col.remove({"t": tenant, "n": name})
def stats(self, name, tenant=None): def stats(self, name, tenant=None):
pass raise NotImplementedError
def actions(self, name, tenant=None, marker=None, limit=10): def actions(self, name, tenant=None, marker=None, limit=10):
pass raise NotImplementedError

View File

@ -86,7 +86,7 @@ class Queue(base.QueueBase):
} }
def actions(self, name, tenant, marker=None, limit=10): def actions(self, name, tenant, marker=None, limit=10):
pass raise NotImplementedError
class Message(base.MessageBase): class Message(base.MessageBase):

View File

@ -51,6 +51,12 @@ class TestSqlite(testing.TestBase):
self.assertEquals( self.assertEquals(
self.queue_ctrl.stats('fizbit', '480924')['messages'], 11) self.queue_ctrl.stats('fizbit', '480924')['messages'], 11)
msgs = list(self.msg_ctrl.list('fizbit', '480924',
echo=True,
limit=20))
self.assertEquals(len(msgs), 11)
msgs = list(self.msg_ctrl.list('fizbit', '480924', msgs = list(self.msg_ctrl.list('fizbit', '480924',
client_uuid='30387f00')) client_uuid='30387f00'))

View File

@ -27,4 +27,4 @@ class DriverBase:
Called to start listening for client requests when Marconi is Called to start listening for client requests when Marconi is
ran in self-hosting mode. ran in self-hosting mode.
""" """
pass raise NotImplementedError

View File

@ -33,4 +33,4 @@ class Driver(transport.DriverBase):
api.add_route('/v1/{tenant_id}/queues/{queue_name}', queues) api.add_route('/v1/{tenant_id}/queues/{queue_name}', queues)
def listen(self): def listen(self):
pass raise NotImplementedError

View File

@ -18,7 +18,7 @@
import setuptools import setuptools
import __builtin__ import __builtin__
__builtin__.__MARCONI_SETUP__ = None __builtin__.__MARCONI_SETUP__ = True
from marconi.openstack.common import setup as common_setup from marconi.openstack.common import setup as common_setup
requires = common_setup.parse_requirements() requires = common_setup.parse_requirements()