예제 #1
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(
    os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda: 0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import MemcachedTextConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)


def iequal(left, right, level=1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (
            tb[0], tb[1], repr(left), repr(right))
        return False
    return True


def inequal(left, right, level=0):
    if (left == right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1], repr(left),
                                                    repr(right))
        return False
예제 #2
0
import os
import sys
import shlex
import inspect
import traceback

from subprocess import PIPE, Popen, STDOUT

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)
mc.flush()

cmd = shlex.split('capable/memcapable -a -p %s -h %s -v' %
        (iproto.py_con.port, '127.0.0.1'))

task = Popen(cmd, stdout=PIPE, stderr=STDOUT)

print task.communicate()[0]

sys.path = saved_path
예제 #3
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(
    os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda: 0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)


def iequal(left, right, level=1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (
            tb[0], tb[1], repr(left), repr(right))
        return False
    return True


def inequal(left, right, level=0):
    if (left == right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1], repr(left),
                                                    repr(right))
        return False
    return True
예제 #4
0
import os
import sys
import time
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

def iequal(left, right, level = 1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def issert(stmt, level = 1):
    if not bool(stmt):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: result is False" % (tb[0], tb[1])
        return False
    return True

def __check(res, flags, val, level = 0):
    return iequal(res.get('flags', -1), flags, level + 1) and \
예제 #5
0
import os
import sys
import time
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

def iequal(left, right, level = 1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        if (isinstance(left, basestring)):
            if (len(left) != len(right)):
                print("length is different")
        return False
    return True

def __check(res, flags, val, level = 0):
    return iequal(res.get('flags', -1), flags, level + 1) and \
            iequal(res.get('val', val), val, level + 1)

def check(key, flags, val, level = 0):
    res = mc.get(key)
예제 #6
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

def iequal(left, right, level = 1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def inequal(left, right, level = 0):
    if (left == right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def issert(stmt, level = 0):
    if bool(stmt):
예제 #7
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

def iequal(left, right, level = 1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def inequal(left, right, level = 0):
    if (left == right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def issert(stmt, level = 0):
    if bool(stmt):
예제 #8
0
import os
import sys
import shlex
import inspect
import traceback

from subprocess import PIPE, Popen, STDOUT

saved_path = sys.path[:]
sys.path.append(
    os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda: 0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)
mc.flush()

cmd = shlex.split('capable/memcapable -b -p %s -h %s -v' %
                  (iproto.py_con.port, '127.0.0.1'))

task = Popen(cmd, stdout=PIPE, stderr=STDOUT)

print task.communicate()[0]

sys.path = saved_path
예제 #9
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda: 0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)


def iequal(left, right, level=1):
    if left != right:
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1], repr(left), repr(right))
        return False
    return True


def inequal(left, right, level=0):
    if left == right:
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1], repr(left), repr(right))
        return False
    return True


def issert(stmt, level=0):
예제 #10
0
import os
import sys
import time
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(
    os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda: 0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)


def iequal(left, right, level=1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (
            tb[0], tb[1], repr(left), repr(right))
        return False
    return True


def issert(stmt, level=1):
    if not bool(stmt):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: result is False" % (tb[0], tb[1])
        return False
    return True
예제 #11
0
import os
import sys
import inspect
import traceback

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import MemcachedTextConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

def iequal(left, right, level = 1):
    if (left != right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s not equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def inequal(left, right, level = 0):
    if (left == right):
        tb = traceback.extract_stack()[-(level + 1)]
        print "Error on line %s:%d: %s equal %s" % (tb[0], tb[1],
                repr(left), repr(right))
        return False
    return True

def issert(stmt, level = 0):