Fix broken tests

This commit is contained in:
Joseph Schorr 2015-07-29 14:21:29 -04:00
parent 6625add94b
commit 572d6ba53c
2 changed files with 32 additions and 29 deletions

View file

@ -6,7 +6,7 @@ import re
from flask.ext.mail import Message from flask.ext.mail import Message
from app import mail, app from app import mail, app
from data import model from data import model
from workers.worker import JobException from workers.queueworker import JobException
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -10,14 +10,7 @@ POLL_PERIOD_SECONDS = 10
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class RepositoryActionCountWorker(Worker): def count_repository_actions():
def __init__(self):
super(RepositoryActionCountWorker, self).__init__()
self.add_operation(self._count_repository_actions, POLL_PERIOD_SECONDS)
def _count_repository_actions(self):
""" Counts actions for a random repository for the previous day. """
with UseThenDisconnect(app.config): with UseThenDisconnect(app.config):
try: try:
# Get a random repository to count. # Get a random repository to count.
@ -46,6 +39,16 @@ class RepositoryActionCountWorker(Worker):
except Repository.DoesNotExist: except Repository.DoesNotExist:
logger.debug('No further repositories to count') logger.debug('No further repositories to count')
class RepositoryActionCountWorker(Worker):
def __init__(self):
super(RepositoryActionCountWorker, self).__init__()
self.add_operation(self._count_repository_actions, POLL_PERIOD_SECONDS)
def _count_repository_actions(self):
""" Counts actions for a random repository for the previous day. """
count_repository_actions()
if __name__ == "__main__": if __name__ == "__main__":
worker = RepositoryActionCountWorker() worker = RepositoryActionCountWorker()
worker.start() worker.start()