mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-04 11:08:11 +08:00
upping the coverage
This commit is contained in:
+2
-4
@@ -46,10 +46,8 @@ class Conf(object):
|
|||||||
LABEL = conf.get('label', 'Django Q')
|
LABEL = conf.get('label', 'Django Q')
|
||||||
|
|
||||||
# Use the secret key for package signing
|
# Use the secret key for package signing
|
||||||
try:
|
# Django itself should raise an error if it's not configured
|
||||||
SECRET_KEY = settings.SECRET_KEY
|
SECRET_KEY = settings.SECRET_KEY
|
||||||
except AttributeError:
|
|
||||||
SECRET_KEY = 'omgicantbelieveudonthaveasecretkey'
|
|
||||||
|
|
||||||
# The redis list key
|
# The redis list key
|
||||||
Q_LIST = 'django_q:{}:q'.format(PREFIX)
|
Q_LIST = 'django_q:{}:q'.format(PREFIX)
|
||||||
|
|||||||
+1
-3
@@ -52,8 +52,6 @@ def monitor(run_once=False):
|
|||||||
status = term.red(str(Conf.STOPPED))
|
status = term.red(str(Conf.STOPPED))
|
||||||
elif stat.status == Conf.IDLE:
|
elif stat.status == Conf.IDLE:
|
||||||
status = str(Conf.IDLE)
|
status = str(Conf.IDLE)
|
||||||
else:
|
|
||||||
status = term.yellow(str(stat.status))
|
|
||||||
# color q's
|
# color q's
|
||||||
tasks = stat.task_q_size
|
tasks = stat.task_q_size
|
||||||
if tasks > 0:
|
if tasks > 0:
|
||||||
@@ -98,7 +96,7 @@ class Status(object):
|
|||||||
self.reincarnations = 0
|
self.reincarnations = 0
|
||||||
self.cluster_id = pid
|
self.cluster_id = pid
|
||||||
self.sentinel = 0
|
self.sentinel = 0
|
||||||
self.status = 'Idle'
|
self.status = Conf.STOPPED
|
||||||
self.done_q_size = 0
|
self.done_q_size = 0
|
||||||
self.host = socket.gethostname()
|
self.host = socket.gethostname()
|
||||||
self.monitor = 0
|
self.monitor = 0
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ def test_cluster_initial(r):
|
|||||||
r.delete(list_key)
|
r.delete(list_key)
|
||||||
c = Cluster(list_key=list_key)
|
c = Cluster(list_key=list_key)
|
||||||
assert c.sentinel is None
|
assert c.sentinel is None
|
||||||
|
assert c.stat.status == Conf.STOPPED
|
||||||
assert c.start() > 0
|
assert c.start() > 0
|
||||||
assert c.sentinel.is_alive() is True
|
assert c.sentinel.is_alive() is True
|
||||||
assert c.is_running
|
assert c.is_running
|
||||||
|
assert c.is_stopping is False
|
||||||
|
assert c.is_starting is False
|
||||||
stat = c.stat
|
stat = c.stat
|
||||||
assert stat.status == Conf.IDLE
|
assert stat.status == Conf.IDLE
|
||||||
assert c.stop() is True
|
assert c.stop() is True
|
||||||
|
|||||||
@@ -59,3 +59,4 @@ def test_scheduler(r):
|
|||||||
)
|
)
|
||||||
assert schedule is not None
|
assert schedule is not None
|
||||||
assert schedule.last_run() is None
|
assert schedule.last_run() is None
|
||||||
|
scheduler()
|
||||||
|
|||||||
Reference in New Issue
Block a user