mirror of
https://github.com/sprockets/sprockets.handlers.heartbeat.git
synced 2024-11-14 19:29:31 +00:00
Update style
Update style to match `Sprockets` conventions.
This commit is contained in:
parent
fe76c7f2ac
commit
de129219ce
3 changed files with 11 additions and 9 deletions
|
@ -25,18 +25,20 @@ Requirements
|
|||
Example
|
||||
-------
|
||||
This examples demonstrates how to use ``sprockets.handlers.heartbeat`` by ...
|
||||
|
||||
.. code:: python
|
||||
|
||||
from tornado import web
|
||||
|
||||
from sprockets import handlers.heartbeat
|
||||
from sprockets.handlers import heartbeat
|
||||
|
||||
def check_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
|
||||
---------------
|
||||
|
|
|
@ -8,10 +8,11 @@ import logging
|
|||
|
||||
from tornado.web import RequestHandler
|
||||
|
||||
|
||||
version_info = (0, 1, 0)
|
||||
__version__ = '.'.join(str(v) for v in version_info)
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
callbacks = []
|
||||
|
||||
|
||||
|
@ -42,4 +43,4 @@ def register_callback(callable_):
|
|||
|
||||
"""
|
||||
callbacks.append(callable_)
|
||||
logging.info('Callback %s registered', callable_.__name__)
|
||||
LOGGER.info('Callback %s registered', callable_.__name__)
|
||||
|
|
7
tests.py
7
tests.py
|
@ -8,14 +8,13 @@ try:
|
|||
except ImportError:
|
||||
import unittest
|
||||
|
||||
from tornado.testing import AsyncHTTPTestCase
|
||||
from tornado.web import Application
|
||||
from tornado import testing, web
|
||||
|
||||
|
||||
from sprockets.handlers import heartbeat
|
||||
|
||||
|
||||
class _BaseHeartbeatHandlerTestCase(AsyncHTTPTestCase):
|
||||
class _BaseHeartbeatHandlerTestCase(testing.AsyncHTTPTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(_BaseHeartbeatHandlerTestCase, self).setUp()
|
||||
|
@ -33,7 +32,7 @@ class _BaseHeartbeatHandlerTestCase(AsyncHTTPTestCase):
|
|||
heartbeat.callbacks = []
|
||||
|
||||
def get_app(self):
|
||||
return Application([('/heartbeat', heartbeat.HeartbeatHandler)])
|
||||
return web.Application([('/heartbeat', heartbeat.HeartbeatHandler)])
|
||||
|
||||
|
||||
class TestHealthyHeartbeat(_BaseHeartbeatHandlerTestCase):
|
||||
|
|
Loading…
Reference in a new issue