]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/build_helpers/test-pip-install.py
add test-pip-install
[tahoe-lafs/tahoe-lafs.git] / misc / build_helpers / test-pip-install.py
1
2 import os, shutil
3 from subprocess import check_call
4
5 # Install tahoe into a new virtualenv, move aside the source tree, run a test
6 # with the installed tahoe. This ensures that the installed code isn't
7 # depending upon anything from the source tree. Requires 'pip' and
8 # 'virtualenv' to be installed, and enough compilers/libraries (libffi-dev)
9 # to enable 'pip install'.
10
11 # This runs a lot faster if you've cached wheels first. Edit ~/.pip/pip.conf
12 # to have [global] wheel-dir=find-links=/HOME/.pip/wheels, then run 'pip
13 # wheel .' from the tahoe tree.
14
15 assert os.path.exists("Tahoe.home"), "Run this from the top of the source tree."
16 VE = "test-pip-install-virtualenv"
17
18 print "creating virtualenv.."
19 if os.path.exists(VE):
20     shutil.rmtree(VE)
21 check_call(["virtualenv", VE])
22 print "running 'pip install .' from virtualenv.."
23 check_call(["%s/bin/pip" % VE, "install", "."])
24 try:
25     print "moving src/ out of the away"
26     os.rename("src", "src-disabled-by-test-pip-install")
27     print "running 'trial allmydata.test.test_web' from virtualenv.."
28     rc = check_call(["%s/bin/trial" % VE, "allmydata.test.test_web"])
29 finally:
30     print "moving src/ back"
31     os.rename("src-disabled-by-test-pip-install", "src")