forked from Incubaid/arakoon
-
Notifications
You must be signed in to change notification settings - Fork 7
/
test_it.py
55 lines (45 loc) · 1.45 KB
/
test_it.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import nose
import subprocess
import sys
root = os.environ.get('TEST_HOME')
if root is None:
raise Exception("TEST_HOME in undefined")
bin_dir = '%s/apps/arakoon/bin' % root
bin = bin_dir +'/arakoon'
def prologue():
if not os.path.exists(bin_dir):
os.makedirs(bin_dir)
if not os.path.exists(bin):
subprocess.call(['cp','./arakoon.native', bin])
print "=> copying exec to: %s" % bin
else:
try:
version = subprocess.check_output(['./arakoon.native','--version'])
version2 = subprocess.check_output([bin,'--version'])
if version <> version2:
print version,version2
print "=> copying exec"
subprocess.call(['cp','./arakoon.native', bin])
else:
print "not copying arakoon executable"
except:
subprocess.call(['cp','./arakoon.native', bin])
subprocess.call(['rm','-rf', '%s/tmp/' % root])
subprocess.call(['rm','-rf', '%s/tmp/' % root])
prologue()
env = os.environ
pwd = os.getcwd()
paths = ':'.join(map (lambda x: pwd + x, ['/pylabs','/pylabs/extensions','/pylabs/pyrakoon']))
print paths
env ['PYTHONPATH'] = paths
cmd = ['nosetests', '-w', 'test']
ldlib = 'LD_LIBRARY_PATH'
if env.has_key(ldlib):
print "LD_LIBRARY_PATH=%s" % env[ldlib]
rest = sys.argv[1:]
cmd.extend(rest)
subprocess.call(cmd,
cwd = './pylabs',
env = env
)