def testStatsCollectorTally(self): print "This test will take about 60 seconds to run!" statsCollector = StatsCollector() statsCollector.start() self.assertEqual(0, statsCollector.getCount("test", 1)) statsCollector.tally("test") sleep(61) self.assertEqual(1, statsCollector.getCount("test", 1))
from gevent import monkey monkey.patch_all() from bottle import run, request, response, get, post logger = logging.getLogger(__name__) # This socket is used to push market data out to the Announcers over ZeroMQ. context = zmq.Context() sender = context.socket(zmq.PUB) validator = Validator() # This import must be done post-monkey-patching! from eddn.core.StatsCollector import StatsCollector statsCollector = StatsCollector() statsCollector.start() def configure(): # Get the list of transports to bind from settings. This allows us to PUB # messages to multiple announcers over a variety of socket types # (UNIX sockets and/or TCP sockets). for binding in Settings.GATEWAY_SENDER_BINDINGS: sender.bind(binding) for schemaRef, schemaFile in Settings.GATEWAY_JSON_SCHEMAS.iteritems(): validator.addSchemaResource( schemaRef, resource_string('eddn.Gateway', schemaFile))