summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/wqueue2.py4
-rw-r--r--tests/tests.py27
2 files changed, 29 insertions, 2 deletions
diff --git a/src/wqueue2.py b/src/wqueue2.py
index 4c2cd4c..f60f947 100755
--- a/src/wqueue2.py
+++ b/src/wqueue2.py
@@ -13,7 +13,7 @@ import collections
u8open = functools.partial(open, encoding='utf8')
-class PersistentQueue3:
+class PersistentQueue:
def __init__(self, filename=None):
self.queue = collections.deque()
@@ -98,7 +98,7 @@ async def manage_client(reader, writer):
async def jobs_runner():
- jobs = PersistentQueue3(filename='queue.txt')
+ jobs = PersistentQueue(filename='queue.txt')
queue = []
while True:
job = await jobs.get_job()
diff --git a/tests/tests.py b/tests/tests.py
new file mode 100644
index 0000000..7b5ec03
--- /dev/null
+++ b/tests/tests.py
@@ -0,0 +1,27 @@
+'''
+This file tests basic working of the implementation such as:
+
+- PersistentQueue
+- Server protocol
+
+'''
+import asyncio
+import ../src/wqueue2
+
+class TestFileQueue:
+
+ def setup(self):
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ self.pq = PersistentQueue()
+
+ def teardown(self):
+ asyncio.set_event_loop(None)
+
+ def test_reload_from_filename():
+ self.pq.
+
+
+
+ def test_persistent_queue():
+ pq = PersistentQueue()