1 2import sys, os, re 3python3 = sys.version_info[0] == 3 4python2 = sys.version_info[0] == 2 5 6srcdir = re.sub(r'/tenjin.*$', r'/tenjin/common/test', os.getcwd()) 7kook_default_product = 'test' 8 9 10@recipe 11@ingreds('test_engine.yaml', 'test_template.yaml') 12def task_copy(c): 13 """copy data file (*.yaml)""" 14 pass 15 16 17@recipe 18@product('test_*.yaml') 19@ingreds(srcdir + '/test_$(1).yaml.eruby') 20def file_test_engine_yaml(c): 21 os.environ['RUBYLIB'] = '' 22 system(c%"erubis -E PercentLine -p '%%%%%%= =%%%%%' -c '@lang=%q|python|' $(ingred) > $(product)") 23 #cp_p(c.ingred, c.product) 24 25 26@recipe 27@ingreds('copy') 28@byprods('test.log') 29@spices('-v: verbose') 30def task_test(c, *args): 31 options, rest = c.parse_cmdopts(args) 32 opts = options.get('v') and ' -v ' or '' 33 system(c%'python test_all.py $(opts)') 34 #if python2: 35 # #system(c%'python test_all.py $(opts) 2>&1 | tee $(byprod)') 36 # system(c%'python test_all.py $(opts)') 37 # #system(c%'python test_all.py $(opts) 2>&1 > $(byprod)') 38 #elif python3: 39 # unsupported_tests = ['test_all.py', 'test_users_guide.py', 'test_faq.py', 40 # 'test_examples.py', 'test_encoding.py', 'test_gae.py', ] 41 # from glob import glob 42 # for x in glob('test_*.py'): 43 # if x not in unsupported_tests: 44 # system(c%'python $(x) $(opts)') 45 # #system(c%'python test_template.py $(opts)') 46 # #system(c%'python test_engine.py $(opts)') 47 # #system(c%'python test_main.py $(opts)') 48 # #system(c%'python test_htmlhelper.py $(opts)') 49 # #system(c%'python test_preprocess.py $(opts)') 50 task_clean(c) 51 52 53@recipe 54def task_clean(c): 55 rm_f('test.log', '*.pyc', '**/*.pyc', '**/*.cache') 56