1# coding=utf-8 2import os 3from pprint import pprint 4 5from _jb_runner_tools import jb_start_tests, jb_doc_args, PROJECT_DIR 6from twisted.scripts import trial 7import sys 8 9 10if __name__ == '__main__': 11 # This folder should be in sys.path because teamcity twisted plugin is there 12 sys.path.append(os.path.join(os.path.dirname(__file__), "__jb.for_twisted")) 13 14 path, targets, additional_args = jb_start_tests() 15 16 sys.path.append(PROJECT_DIR) # Current dir must be in sys.path according to trial docs 17 18 sys.argv.append("--reporter=teamcity") 19 sys.argv += additional_args 20 21 if path: 22 assert os.path.exists(path), path + " does not exist" 23 # assert os.path.isfile(path), path + " is folder. Provide its name as python target (dot separated)" 24 sys.argv.append(os.path.normpath(path)) 25 elif targets: 26 sys.argv += targets 27 28 jb_doc_args("trial", sys.argv[1:]) 29 trial.run() 30