diff --git a/.coveragerc b/.coveragerc index 6718d9611..97f08df7c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,8 @@ [run] branch = True -omit = /usr*,setup.py,*egg*,.venv/*,.tox/*,marconi/tests/* +omit = *marconi/openstack* [report] -ignore-errors = True +exclude_lines = + if __MARCONI_SETUP__: + raise NotImplementedError diff --git a/marconi/__init__.py b/marconi/__init__.py index 46ca13fad..186a11daf 100644 --- a/marconi/__init__.py +++ b/marconi/__init__.py @@ -15,15 +15,14 @@ # Import guard. No module level import during the setup procedure. try: - __MARCONI_SETUP__ # NOQA + if __MARCONI_SETUP__: + import sys as _sys + _sys.stderr.write('Running from marconi source directory.\n') + del _sys except NameError: import gettext gettext.install("marconi", unicode=1) 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 diff --git a/marconi/storage/base.py b/marconi/storage/base.py index 760bb7c67..ca0753955 100644 --- a/marconi/storage/base.py +++ b/marconi/storage/base.py @@ -32,21 +32,21 @@ class DriverBase: """ Returns storage's queues controller """ - pass + raise NotImplementedError @abc.abstractproperty def message_controller(self): """ Returns storage's messages controller """ - pass + raise NotImplementedError @abc.abstractproperty def claim_controller(self): """ Returns storage's claims controller """ - pass + raise NotImplementedError class ControllerBase(object): @@ -83,7 +83,7 @@ class QueueBase(ControllerBase): :returns: List of queues """ - pass + raise NotImplementedError @abc.abstractmethod def get(self, name, tenant=None): @@ -96,7 +96,7 @@ class QueueBase(ControllerBase): :returns: Dictionary containing queue metadata :raises: DoesNotExist """ - pass + raise NotImplementedError @abc.abstractmethod def upsert(self, name, metadata, tenant=None): @@ -121,7 +121,7 @@ class QueueBase(ControllerBase): :param name: The queue name :param tenant: Tenant id """ - pass + raise NotImplementedError @abc.abstractmethod def stats(self, name, tenant=None): @@ -133,7 +133,7 @@ class QueueBase(ControllerBase): :returns: Dictionary with the queue stats """ - pass + raise NotImplementedError @abc.abstractmethod def actions(self, name, tenant=None, marker=None, limit=10): @@ -146,7 +146,7 @@ class QueueBase(ControllerBase): :param limit: (Default 10) Max number of messages to retrieve. """ - pass + raise NotImplementedError class MessageBase(ControllerBase): @@ -181,7 +181,7 @@ class MessageBase(ControllerBase): :returns: List of messages :raises: DoesNotExist """ - pass + raise NotImplementedError @abc.abstractmethod def post(self, queue, messages, tenant=None): @@ -199,7 +199,7 @@ class MessageBase(ControllerBase): :returns: List of message ids """ - pass + raise NotImplementedError @abc.abstractmethod 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 it. """ - pass + raise NotImplementedError class ClaimBase(ControllerBase): @@ -236,7 +236,7 @@ class ClaimBase(ControllerBase): metadata and claimed messages. :raises: DoesNotExist """ - pass + raise NotImplementedError @abc.abstractmethod def create(self, queue, tenant=None, ttl=MIN_TTL, limit=10): @@ -254,7 +254,7 @@ class ClaimBase(ControllerBase): :returns: Dictionary containing claim's metadata and claimed messages. """ - pass + raise NotImplementedError @abc.abstractmethod def update(self, queue, claim_id, tenant=None, **metadata): @@ -268,7 +268,7 @@ class ClaimBase(ControllerBase): :param metadata: Claim's parameters to be updated. """ - pass + raise NotImplementedError @abc.abstractmethod def delete(self, queue, claim_id, tenant=None): @@ -280,7 +280,7 @@ class ClaimBase(ControllerBase): :param claim_id: Claim to be deleted :param tenant: Tenant id """ - pass + raise NotImplementedError @abc.abstractmethod def stats(self, queue, claim_id, tenant=None): @@ -294,4 +294,4 @@ class ClaimBase(ControllerBase): :returns: Dictionary with the queue stats """ - pass + raise NotImplementedError diff --git a/marconi/storage/mongodb/controllers.py b/marconi/storage/mongodb/controllers.py index 0e0d77b26..30f6b91d3 100644 --- a/marconi/storage/mongodb/controllers.py +++ b/marconi/storage/mongodb/controllers.py @@ -82,7 +82,7 @@ class QueueController(storage.QueueBase): self._col.remove({"t": tenant, "n": name}) def stats(self, name, tenant=None): - pass + raise NotImplementedError def actions(self, name, tenant=None, marker=None, limit=10): - pass + raise NotImplementedError diff --git a/marconi/storage/sqlite/controllers.py b/marconi/storage/sqlite/controllers.py index d2b159de8..939e3a996 100644 --- a/marconi/storage/sqlite/controllers.py +++ b/marconi/storage/sqlite/controllers.py @@ -86,7 +86,7 @@ class Queue(base.QueueBase): } def actions(self, name, tenant, marker=None, limit=10): - pass + raise NotImplementedError class Message(base.MessageBase): diff --git a/marconi/tests/test_sqlite.py b/marconi/tests/test_sqlite.py index d47424ec4..6888b59ae 100644 --- a/marconi/tests/test_sqlite.py +++ b/marconi/tests/test_sqlite.py @@ -51,6 +51,12 @@ class TestSqlite(testing.TestBase): self.assertEquals( 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', client_uuid='30387f00')) diff --git a/marconi/transport/base.py b/marconi/transport/base.py index 8c06d1bef..e334dd5b5 100644 --- a/marconi/transport/base.py +++ b/marconi/transport/base.py @@ -27,4 +27,4 @@ class DriverBase: Called to start listening for client requests when Marconi is ran in self-hosting mode. """ - pass + raise NotImplementedError diff --git a/marconi/transport/wsgi/driver.py b/marconi/transport/wsgi/driver.py index 0f590c75b..d8324931c 100644 --- a/marconi/transport/wsgi/driver.py +++ b/marconi/transport/wsgi/driver.py @@ -33,4 +33,4 @@ class Driver(transport.DriverBase): api.add_route('/v1/{tenant_id}/queues/{queue_name}', queues) def listen(self): - pass + raise NotImplementedError diff --git a/setup.py b/setup.py index 3de134290..9cd611948 100755 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ import setuptools import __builtin__ -__builtin__.__MARCONI_SETUP__ = None +__builtin__.__MARCONI_SETUP__ = True from marconi.openstack.common import setup as common_setup requires = common_setup.parse_requirements()