Show More
@@ -14,13 +14,13 b' class TestNotebookManager(TestCase):' | |||||
14 | def test_nb_dir(self): |
|
14 | def test_nb_dir(self): | |
15 | with TemporaryDirectory() as td: |
|
15 | with TemporaryDirectory() as td: | |
16 | km = FileNotebookManager(notebook_dir=td) |
|
16 | km = FileNotebookManager(notebook_dir=td) | |
17 |
self.assertEqual |
|
17 | self.assertEqual(km.notebook_dir, td) | |
18 |
|
18 | |||
19 | def test_create_nb_dir(self): |
|
19 | def test_create_nb_dir(self): | |
20 | with TemporaryDirectory() as td: |
|
20 | with TemporaryDirectory() as td: | |
21 | nbdir = os.path.join(td, 'notebooks') |
|
21 | nbdir = os.path.join(td, 'notebooks') | |
22 | km = FileNotebookManager(notebook_dir=nbdir) |
|
22 | km = FileNotebookManager(notebook_dir=nbdir) | |
23 |
self.assertEqual |
|
23 | self.assertEqual(km.notebook_dir, nbdir) | |
24 |
|
24 | |||
25 | def test_missing_nb_dir(self): |
|
25 | def test_missing_nb_dir(self): | |
26 | with TemporaryDirectory() as td: |
|
26 | with TemporaryDirectory() as td: |
@@ -238,14 +238,14 b' class TestDictBackend(TaskDBTest, TestCase):' | |||||
238 | self.db.record_limit = 20 |
|
238 | self.db.record_limit = 20 | |
239 | self.db.cull_fraction = 0.2 |
|
239 | self.db.cull_fraction = 0.2 | |
240 | self.load_records(20) |
|
240 | self.load_records(20) | |
241 |
self.assertEqual |
|
241 | self.assertEqual(len(self.db.get_history()), 20) | |
242 | self.load_records(1) |
|
242 | self.load_records(1) | |
243 | # 0.2 * 20 = 4, 21 - 4 = 17 |
|
243 | # 0.2 * 20 = 4, 21 - 4 = 17 | |
244 |
self.assertEqual |
|
244 | self.assertEqual(len(self.db.get_history()), 17) | |
245 | self.load_records(3) |
|
245 | self.load_records(3) | |
246 |
self.assertEqual |
|
246 | self.assertEqual(len(self.db.get_history()), 20) | |
247 | self.load_records(1) |
|
247 | self.load_records(1) | |
248 |
self.assertEqual |
|
248 | self.assertEqual(len(self.db.get_history()), 17) | |
249 |
|
249 | |||
250 | for i in range(100): |
|
250 | for i in range(100): | |
251 | self.load_records(1) |
|
251 | self.load_records(1) | |
@@ -257,12 +257,12 b' class TestDictBackend(TaskDBTest, TestCase):' | |||||
257 | self.db.size_limit = 1000 |
|
257 | self.db.size_limit = 1000 | |
258 | self.db.cull_fraction = 0.2 |
|
258 | self.db.cull_fraction = 0.2 | |
259 | self.load_records(100, buffer_size=10) |
|
259 | self.load_records(100, buffer_size=10) | |
260 |
self.assertEqual |
|
260 | self.assertEqual(len(self.db.get_history()), 100) | |
261 | self.load_records(1, buffer_size=0) |
|
261 | self.load_records(1, buffer_size=0) | |
262 |
self.assertEqual |
|
262 | self.assertEqual(len(self.db.get_history()), 101) | |
263 | self.load_records(1, buffer_size=1) |
|
263 | self.load_records(1, buffer_size=1) | |
264 | # 0.2 * 100 = 20, 101 - 20 = 81 |
|
264 | # 0.2 * 100 = 20, 101 - 20 = 81 | |
265 |
self.assertEqual |
|
265 | self.assertEqual(len(self.db.get_history()), 81) | |
266 |
|
266 | |||
267 | def test_cull_size_drop(self): |
|
267 | def test_cull_size_drop(self): | |
268 | """dropping records updates tracked buffer size""" |
|
268 | """dropping records updates tracked buffer size""" | |
@@ -270,15 +270,15 b' class TestDictBackend(TaskDBTest, TestCase):' | |||||
270 | self.db.size_limit = 1000 |
|
270 | self.db.size_limit = 1000 | |
271 | self.db.cull_fraction = 0.2 |
|
271 | self.db.cull_fraction = 0.2 | |
272 | self.load_records(100, buffer_size=10) |
|
272 | self.load_records(100, buffer_size=10) | |
273 |
self.assertEqual |
|
273 | self.assertEqual(len(self.db.get_history()), 100) | |
274 | self.db.drop_record(self.db.get_history()[-1]) |
|
274 | self.db.drop_record(self.db.get_history()[-1]) | |
275 |
self.assertEqual |
|
275 | self.assertEqual(len(self.db.get_history()), 99) | |
276 | self.load_records(1, buffer_size=5) |
|
276 | self.load_records(1, buffer_size=5) | |
277 |
self.assertEqual |
|
277 | self.assertEqual(len(self.db.get_history()), 100) | |
278 | self.load_records(1, buffer_size=5) |
|
278 | self.load_records(1, buffer_size=5) | |
279 |
self.assertEqual |
|
279 | self.assertEqual(len(self.db.get_history()), 101) | |
280 | self.load_records(1, buffer_size=1) |
|
280 | self.load_records(1, buffer_size=1) | |
281 |
self.assertEqual |
|
281 | self.assertEqual(len(self.db.get_history()), 81) | |
282 |
|
282 | |||
283 | def test_cull_size_update(self): |
|
283 | def test_cull_size_update(self): | |
284 | """updating records updates tracked buffer size""" |
|
284 | """updating records updates tracked buffer size""" | |
@@ -286,12 +286,12 b' class TestDictBackend(TaskDBTest, TestCase):' | |||||
286 | self.db.size_limit = 1000 |
|
286 | self.db.size_limit = 1000 | |
287 | self.db.cull_fraction = 0.2 |
|
287 | self.db.cull_fraction = 0.2 | |
288 | self.load_records(100, buffer_size=10) |
|
288 | self.load_records(100, buffer_size=10) | |
289 |
self.assertEqual |
|
289 | self.assertEqual(len(self.db.get_history()), 100) | |
290 | msg_id = self.db.get_history()[-1] |
|
290 | msg_id = self.db.get_history()[-1] | |
291 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(10)], buffers=[])) |
|
291 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(10)], buffers=[])) | |
292 |
self.assertEqual |
|
292 | self.assertEqual(len(self.db.get_history()), 100) | |
293 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(11)], buffers=[])) |
|
293 | self.db.update_record(msg_id, dict(result_buffers = [os.urandom(11)], buffers=[])) | |
294 |
self.assertEqual |
|
294 | self.assertEqual(len(self.db.get_history()), 79) | |
295 |
|
295 | |||
296 | class TestSQLiteBackend(TaskDBTest, TestCase): |
|
296 | class TestSQLiteBackend(TaskDBTest, TestCase): | |
297 |
|
297 |
@@ -605,7 +605,7 b' class TestView(ClusterTestCase, ParametricTestCase):' | |||||
605 | view = self.client[-1] |
|
605 | view = self.client[-1] | |
606 | ar = view.apply_async(bar) |
|
606 | ar = view.apply_async(bar) | |
607 | r = ar.get(10) |
|
607 | r = ar.get(10) | |
608 |
self.assertEqual |
|
608 | self.assertEqual(r, 'foo') | |
609 | def test_data_pub_single(self): |
|
609 | def test_data_pub_single(self): | |
610 | view = self.client[-1] |
|
610 | view = self.client[-1] | |
611 | ar = view.execute('\n'.join([ |
|
611 | ar = view.execute('\n'.join([ |
General Comments 0
You need to be logged in to leave comments.
Login now