Separated Cluster and Sentinel into two classes.

This commit is contained in:
Ilan Steemers
2015-06-19 22:24:27 +02:00
parent 45e5187126
commit ed9883470d
3 changed files with 66 additions and 34 deletions
+22
View File
@@ -0,0 +1,22 @@
import sys
import os
from time import sleep
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
import pytest
from django_q import Cluster
@pytest.fixture(scope='session')
def cluster():
return Cluster()
def test_cluster_initial(cluster):
cluster.start()
assert cluster.sentinel.is_alive() is True
cluster.stop()
sleep(2)
assert cluster.sentinel.is_alive() is False
-15
View File
@@ -1,15 +0,0 @@
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
import pytest
from django_q import Cluster
@pytest.fixture(scope='session')
def cluster():
return Cluster()
def test_worker(cluster):
assert len(cluster.stable) == cluster.stable_size