Commit 8cb16d74 authored by Julien Muchembled's avatar Julien Muchembled

New extraCellSortKey and getUnpickler methods for threaded tests

parent 81c93b67
......@@ -19,6 +19,7 @@
import os, random, socket, sys, tempfile, threading, time, types, weakref
from collections import deque
from functools import wraps
from zlib import decompress
from mock import Mock
import transaction, ZODB
import neo.admin.app, neo.master.app, neo.storage.app
......@@ -623,6 +624,10 @@ class NEOCluster(object):
node.close()
self.client.em.close()
def extraCellSortKey(self, key):
return Patch(self.client.cp, _getCellSortKey=lambda orig, *args:
(orig(*args), key(*args)))
class NEOThreadedTest(NeoTestBase):
......@@ -630,6 +635,16 @@ class NEOThreadedTest(NeoTestBase):
log_file = os.path.join(getTempDirectory(), self.id() + '.log')
setupLog(LoggerThreadName(), log_file, True)
def getUnpickler(self, conn):
reader = conn._reader
def unpickler(data, compression=False):
if compression:
data = decompress(data)
obj = reader.getGhost(data)
reader.setGhostState(obj, data)
return obj
return unpickler
class newThread(threading.Thread):
def __init__(self, func, *args, **kw):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment