Update style

Update style to match `Sprockets` conventions.
This commit is contained in:
johnb 2014-10-14 11:48:28 -04:00
parent fe76c7f2ac
commit de129219ce
3 changed files with 11 additions and 9 deletions

View file

@ -25,18 +25,20 @@ Requirements
Example Example
------- -------
This examples demonstrates how to use ``sprockets.handlers.heartbeat`` by ... This examples demonstrates how to use ``sprockets.handlers.heartbeat`` by ...
.. code:: python .. code:: python
from tornado import web from tornado import web
from sprockets import handlers.heartbeat from sprockets.handlers import heartbeat
def check_database(): def check_database():
# Verify connectivity to our database # Verify connectivity to our database
return is_database_up() # Return True/False
handlers.heartbeat.register_callback(check_database) heartbeat.register_callback(check_database)
app = web.Application([(r'/heartbeat', handlers.heartbeat.HeartbeatHandler)]) app = web.Application([(r'/heartbeat', heartbeat.HeartbeatHandler)])
Version History Version History
--------------- ---------------

View file

@ -8,10 +8,11 @@ import logging
from tornado.web import RequestHandler from tornado.web import RequestHandler
version_info = (0, 1, 0) version_info = (0, 1, 0)
__version__ = '.'.join(str(v) for v in version_info) __version__ = '.'.join(str(v) for v in version_info)
LOGGER = logging.getLogger(__name__)
callbacks = [] callbacks = []
@ -42,4 +43,4 @@ def register_callback(callable_):
""" """
callbacks.append(callable_) callbacks.append(callable_)
logging.info('Callback %s registered', callable_.__name__) LOGGER.info('Callback %s registered', callable_.__name__)

View file

@ -8,14 +8,13 @@ try:
except ImportError: except ImportError:
import unittest import unittest
from tornado.testing import AsyncHTTPTestCase from tornado import testing, web
from tornado.web import Application
from sprockets.handlers import heartbeat from sprockets.handlers import heartbeat
class _BaseHeartbeatHandlerTestCase(AsyncHTTPTestCase): class _BaseHeartbeatHandlerTestCase(testing.AsyncHTTPTestCase):
def setUp(self): def setUp(self):
super(_BaseHeartbeatHandlerTestCase, self).setUp() super(_BaseHeartbeatHandlerTestCase, self).setUp()
@ -33,7 +32,7 @@ class _BaseHeartbeatHandlerTestCase(AsyncHTTPTestCase):
heartbeat.callbacks = [] heartbeat.callbacks = []
def get_app(self): def get_app(self):
return Application([('/heartbeat', heartbeat.HeartbeatHandler)]) return web.Application([('/heartbeat', heartbeat.HeartbeatHandler)])
class TestHealthyHeartbeat(_BaseHeartbeatHandlerTestCase): class TestHealthyHeartbeat(_BaseHeartbeatHandlerTestCase):