From 583671785035f0ee71fd43025194292a4dd8ca18 Mon Sep 17 00:00:00 2001 From: Wende Tan Date: Sun, 2 Apr 2017 14:17:38 +0800 Subject: [PATCH] try fix ci --- vj4/test/base.py | 18 ++++++++++++++++++ vj4/test/test_job.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/vj4/test/base.py b/vj4/test/base.py index 35c8715d..c692d5cf 100644 --- a/vj4/test/base.py +++ b/vj4/test/base.py @@ -7,6 +7,7 @@ from vj4 import db from vj4.service import bus +from vj4.model import queue from vj4.service import event from vj4.service import smallcache from vj4.util import options @@ -42,6 +43,23 @@ def tearDown(self): super(BusTestCase, self).tearDown() +class QueueTestCase(DatabaseTestCase): + async def noop(*args, **kwargs): + pass + + def setUp(self): + super(QueueTestCase, self).setUp() + self.old_publish = queue.publish + queue.publish = QueueTestCase.noop + self.old_consume = queue.consume + queue.consume = QueueTestCase.noop + + def tearDown(self): + queue.publish = self.old_publish + queue.consume = self.old_consume + super(QueueTestCase, self).tearDown() + + class SmallcacheTestCase(BusTestCase): def setUp(self): super(SmallcacheTestCase, self).setUp() diff --git a/vj4/test/test_job.py b/vj4/test/test_job.py index 38c61f42..fd39dddf 100644 --- a/vj4/test/test_job.py +++ b/vj4/test/test_job.py @@ -19,7 +19,7 @@ EPS = 10 ** (-5) -class RecordTestCase(base.DatabaseTestCase): +class RecordTestCase(base.QueueTestCase): async def init_record(self): self.pid1 = await problem.add(DOMAIN_ID, 'a+b', 'calc a+b', OWNER_UID) self.pid2 = await problem.add(DOMAIN_ID, 'a-b', 'calc a-b', OWNER_UID)