import test_ikfast options = parseoptions() test_ikfast.options = options format = logging.Formatter('%(name)s: %(levelname)s %(message)s') handler = logging.StreamHandler(sys.stderr) handler.setFormatter(format) multiprocess.log.addHandler(handler) multiprocess.log.setLevel(options.debug) #ikfast.log.addHandler(handler) #ikfast.log.setLevel(options.debug) multiprocess._instantiate_plugins = [capture.Capture, xunitmultiprocess.Xunitmp, callableclass.CallableClass] header = 'name=\"%s robots\" package=\"%s\"'%(options.robots,ikfast.__name__) argv=['nosetests','-v','--with-xunitmp','--xunit-file=test_ikfast.xml','--xunit-header=%s'%header,'--processes=%d'%options.numprocesses,'--process-timeout=%f'%options.timeout,'--process-restartworker','--with-callableclass','test_ikfast.py'] plugins=[capture.Capture(),multiprocess.MultiProcess(),xunitmultiprocess.Xunitmp(),callableclass.CallableClass()] prog=nose.core.TestProgram(argv=argv,plugins=plugins,exit=False) log.info('processing the global stats') stats = [] while len(test_ikfast.globalstats) > 0: stat = test_ikfast.globalstats.pop(0) if not stat[5] is None: with open(stat[5],'r') as f: stat.append(f.read()) else: stat.append(None) stats.append(stat) with open('ikfaststats.pp','wb') as f: pickle.dump([stats,options], f)
multiprocess._instantiate_plugins = [ capture.Capture, xunitmultiprocess.Xunitmp, callableclass.CallableClass ] header = 'name=\"%s robots\" package=\"%s\"' % (options.robots, ikfast.__name__) argv = [ 'nosetests', '-v', '--with-xunitmp', '--xunit-file=test_ikfast.xml', '--xunit-header=%s' % header, '--processes=%d' % options.numprocesses, '--process-timeout=%f' % options.timeout, '--process-restartworker', '--with-callableclass', 'test_ikfast.py' ] plugins = [ capture.Capture(), multiprocess.MultiProcess(), xunitmultiprocess.Xunitmp(), callableclass.CallableClass() ] prog = nose.core.TestProgram(argv=argv, plugins=plugins, exit=False) log.info('processing the global stats') stats = [] while len(test_ikfast.globalstats) > 0: stat = test_ikfast.globalstats.pop(0) if not stat[5] is None: stat.append(open(stat[5], 'r').read()) else: stat.append(None) stats.append(stat) pickle.dump([stats, options], open('ikfaststats.pp', 'w'))
help='set to run only tests that test program execution to make sure things run on the current OS') parser.add_option('--test',action='store',dest='testname',default=None, help='manually specify a test') (options, args) = parser.parse_args() numprocesses = options.numprocesses if options.numprocesses is not None else cpu_count() if usemultiprocess: print 'using multiprocess' multiprocess._instantiate_plugins = [capture.Capture, xunitmultiprocess.Xunitmp,failuredetail.FailureDetail,callableclass.CallableClass] handler = logging.StreamHandler(sys.stderr) handler.setFormatter(logging.Formatter('%(name)s %(asctime)s: %(levelname)s %(message)s')) multiprocess.log.addHandler(handler) multiprocess.log.setLevel(logging.DEBUG) else: print 'multiprocess disabled' argv=['nosetests','-v','-d','--with-callableclass','-s'] if options.os_only: argv.append('test_programs.py') if options.testname is not None: argv.append(options.testname) if options.with_coverage: argv += ['--with-coverage', '--cover-package=openravepy','--cover-html'] plugins=[capture.Capture(),failuredetail.FailureDetail(),callableclass.CallableClass()] if usemultiprocess: plugins+=[multiprocess.MultiProcess(),xunitmultiprocess.Xunitmp()] argv += ['--with-xunitmp','--xunit-file=results.xml','--processes=%d'%numprocesses,'--process-timeout=%f'%options.timeout,'--process-restartworker'] # from IPython import embed; embed() prog=nose.core.TestProgram(argv=argv,plugins=plugins,exit=False)