forked from JetBrains/teamcity-messages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
58 lines (41 loc) · 1.41 KB
/
tests.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
56
57
58
import atexit
import sys
import shutil
import tempfile
from os.path import join
from test import tc_msg, FRAMEWORKS, clean_directory, find_script, eggs, generate_test_name
__author__ = 'Leonid Bushuev'
def main():
success = runner()
sys.exit(0 if success else 1)
def runner():
temp = tempfile.mkdtemp()
atexit.register(shutil.rmtree, temp)
ok = True
for fw in FRAMEWORKS:
fw_name = fw.name
fw_version = fw.version
test = generate_test_name(fw_name, fw_version)
tc_msg("##teamcity[testStarted name='%s']" % test)
try:
result = run(fw, temp)
if result < 2:
ok = False
finally:
tc_msg("##teamcity[testFinished name='%s']" % test)
return ok
def run(fw, temp):
venv = join(temp, "venv-" + fw.name)
clean_directory(venv)
from test_support import virtualenv
# virtualenv.logger = virtualenv.Logger([(virtualenv.Logger.DEBUG, sys.stdout)])
virtualenv.DISTRIBUTE_SETUP_PY = virtualenv.DISTRIBUTE_SETUP_PY.replace("0.6.28", "0.6.34")
virtualenv.create_environment(venv, use_distribute=True,
never_download=True, search_dirs=[eggs])
import subprocess
python = find_script(venv, "python")
rc = subprocess.call([python, "test.py", fw.name, fw.version, venv])
return rc
##########################
if __name__ == "__main__":
main()