当前位置: 首页>>代码示例>>Python>>正文


Python test.run函数代码示例

本文整理汇总了Python中test.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_case

def run_case(rootdir, nx, ndrifters):
    
    ## Make grid ##

    print 'Making grid for %s' % rootdir

    shp = (3, 29, nx)

    grdshp = (shp[1]+3, shp[2]+3)
    make_grd(rootdir, Hmin=100.0, alpha=0.0, f=0,
             dx=3e3, dy=3e3, shp=grdshp)


    ## Make synthetic velocity fields ##

    print 'Making model output...'

    make_uv.make(rootdir)


    ## Run TracPy ##

    print 'Running TracPy...'

    test.run(rootdir, ndrifters)


    ## Remove simulation run files to save space ##

    print 'Deleting ocean simulation files...'

    outputloc = os.path.join(rootdir, 'ocean_his_0001.nc')
    os.system('rm ' + outputloc)
开发者ID:kthyng,项目名称:tracpy_performance,代码行数:33,代码来源:run_case.py

示例2: main

def main(argv):
    """ """

    parser = OptionParser("usage: %prog [options] testname")
    parser.add_option("--tb", dest="tbname",
        default="ion_core",
        help="use RTL testbench NAME", metavar="NAME")
    parser.add_option("--regression", dest="regression",
        default=None,
        help="execute regression list in FILE", metavar="FILE")
    parser.add_option("-q", "--quiet",
        action="store_true", dest="quiet", default=False,
        help="don't print build and simulation output to console")
    parser.add_option("-n", "--noexitcode",
        action="store_false", dest="check_exit", default=True,
        help="don't check test program exit code")
    parser.add_option("-r", "--rtl",
        action="store_true", dest="only_rtl", default=False,
        help="run only RTL simulation")
    parser.add_option("-s", "--sw",
        action="store_true", dest="only_sw", default=False,
        help="run only software simulation")
    (opts, args) = parser.parse_args()
    
    if not opts.regression and len(args) != 1:
        print >> sys.stderr, "Error: Must specify a test name or a regression list file.\n"
        parser.print_help()
        sys.exit(1)
        
    test.run(opts.tbname, args[0], 
        hw=not opts.only_sw,
        sw=not opts.only_rtl,
        quiet=opts.quiet, 
        check_output=opts.check_exit)
开发者ID:HackLinux,项目名称:ION,代码行数:34,代码来源:runtest.py

示例3: run

 def run(self, *args, **kwargs):
     if self.distribution.install_requires:
         self.distribution.fetch_build_eggs(self.\
                                             distribution.install_requires)
     if self.distribution.tests_require:
         self.distribution.fetch_build_eggs(self.distribution.tests_require)
     from test import run
     run()
开发者ID:denz,项目名称:swarm-http,代码行数:8,代码来源:setup.py

示例4: init

def init(arg):
	tests = []
	for i in os.listdir("test/tests"):
		if i != "__init__.py" and i[-3:] == ".py":
			tests.append(i.split(".")[0])

	if arg[1] in tests:
		test.run(arg[1])
	else:
		print("Options are: {}".format(tests))
开发者ID:BGCAV,项目名称:util,代码行数:10,代码来源:__init__.py

示例5: run_tests

def run_tests(tests,
              verbose,
              continue_failure,
              control):
  for test in test_generator(tests, util.get_arches(), verbose):
    try:
      test.config()
      test.build(force_build=False)
      test.run(control=control)
    except Exception as e:
      handle_failure(test, e)
      if not continue_failure:
        break
开发者ID:plasma-umass,项目名称:proto,代码行数:13,代码来源:runner.py

示例6: main

def main(_):
    FLAGS = tf.app.flags.FLAGS
    pp = pprint.PrettyPrinter()
    FLAGS._parse_flags()
    pp.pprint(FLAGS.__flags)

    # Load Data
    X_train, Q_train, Y_train = data_helper.load_data('train')
    X_test, Q_test, Y_test = data_helper.load_data('valid')

    vocab_size = np.max(X_train) + 1
    print('[?] Vocabulary Size:', vocab_size)

    # Create directories
    if not os.path.exists(FLAGS.ckpt_dir):
        os.makedirs(FLAGS.ckpt_dir)

    timestamp = datetime.now().strftime('%c')
    FLAGS.log_dir = os.path.join(FLAGS.log_dir, timestamp)
    if not os.path.exists(FLAGS.log_dir):
        os.makedirs(FLAGS.log_dir)

    # Train Model
    with tf.Session(config=tf.ConfigProto(log_device_placement=False, allow_soft_placement=True)) as sess, tf.device('/gpu:0'):
        model = AlternatingAttention(FLAGS.batch_size, vocab_size, FLAGS.encoding_dim, FLAGS.embedding_dim, FLAGS.num_glimpses, session=sess)

        if FLAGS.trace: # Trace model for debugging
            train.trace(FLAGS, sess, model, (X_train, Q_train, Y_train))
            return

        saver = tf.train.Saver()

        if FLAGS.restore_file is not None:
            print('[?] Loading variables from checkpoint %s' % FLAGS.restore_file)
            saver.restore(sess, FLAGS.restore_file)

        # Run evaluation
        if FLAGS.evaluate:
            if not FLAGS.restore_file:
                print('Need to specify a restore_file checkpoint to evaluate')
            else:
                test_data = data_helper.load_data('test')
                word2idx, _, _ = data_helper.build_vocab()
                test.run(FLAGS, sess, model, test_data, word2idx)
        else:
            train.run(FLAGS, sess, model,
                    (X_train, Q_train, Y_train),
                    (X_test, Q_test, Y_test),
                    saver)
开发者ID:MrCrumpets,项目名称:alternating-reader-tf,代码行数:49,代码来源:main.py

示例7: scence1

def scence1(screen):
    #background = gameObject.createBgd(tileSheet)
    screen.fill((0,0,0))
    zeldaDialog = Dialog(screen, zeldaPhoto)
    linkDialog = Dialog(screen, linkPhoto)
    unNoDialog = Dialog(screen)

    unNoDialog.message = (
            "???: Excuse me! Sir. ",
            "Princess Zelda would like to have a word with you. ",
            "She is waiting for you in front of the castle. ",
            "Do not make princess waiting for you to long. ",)
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = (
            "Ok, let me explain the basic control. ",
            "Basicly, there are three keyboard you have to know: ",
            "Escape key: exit from current state (useless in dialog) ",
            "Spacebar  : to advance dialog, to talk, to start the game ",
            "Enter key : mostly work the same as spacebar ",
            "use arrow key to move. ")
    unNoDialog.show = True
    unNoDialog.sndNext()

    linkDialog.message = (
            "Ok! I will be there right away. ",
            "Thank you. ")
    linkDialog.show = True
    linkDialog.sndNext()

    if test.run(screen):
        keepGoing = True
    else:
        keepGoing = False
        return True     #donePlayer = True

    cover = pygame.Surface(screen.get_size())
    cover.fill((0,0,0,0))
    cover = cover.convert()

    alpha = 0

    time = pygame.time.Clock()

    pygame.mixer.music.fadeout(500)

    while keepGoing:
        time.tick(30)

        if alpha >= 255:
            keepGoing = False
        cover.set_alpha(alpha)
        alpha += 5
        screen.blit(cover, (0,0))
        pygame.display.flip()

    return False    #donePlaying = false
开发者ID:Morfyo,项目名称:PYTHON,代码行数:57,代码来源:gameScence.py

示例8: runtests

def runtests(tests, args):
	for t in tests:
		tid = test.id(t)
		if not tid:
			continue
		try:
			targs = list(args)
			if test.run(t, tid, targs):
				print("OK     : "+test.info(t)+" ["+tid+"]");
			else:
				print("FAIL   : "+test.info(t)+" ["+tid+"]");
		except:
			print("EXCEPTION while running test with ID: "+tid);
			raise
			return 1
	return 0
开发者ID:epu,项目名称:rsvndump,代码行数:16,代码来源:tdb.py

示例9: load_module

list fs20 tx
list fs20 tx tempix
list fs20 tx hygrix
async:
	wait:
		for 0.1
		debug force
	del fs20 receiver foobar
	wait:
		for 0.1
		debug force
	del fs20 sender bar foo
wait:
	for 0.7
	debug force
list fs20 receiver
list fs20 sender
shutdown
"""

main_words.register_statement(ShutdownHandler)
main_words.register_statement(Load)

load_module("block")
load_module("file")
load_module("data")
load_module("ifelse")
load_module("path")

run("fs20", input)
开发者ID:smurfix,项目名称:HomEvenT,代码行数:30,代码来源:mod_fs20.py

示例10: WhatHandler

	name="for"
	doc="for you!"
	
class WhatHandler(sbr,ComplexStatement):
	name="what"
	doc="What is this?"

class FoiledHandler(sbr,Statement):
	name="foiled"
	doc="not clingfilm"

BarHandler.register_statement(WhatHandler)
BarHandler.register_statement(ForHandler)
ForHandler.register_statement(FoiledHandler)
main_words.register_statement(FooHandler)
main_words.register_statement(BarHandler)
main_words.register_statement(ShutdownHandler)
load_module("help")

class TestInterpreter(Interpreter):
	def complex_statement(self,args):
		fn = self.ctx.words.lookup(args)
		fn = fn(self.ctx)
		fn.called(args)
		fn.start_block()
		return TestInterpreter(ctx=self.ctx(words=fn))
	def done(self):
		log(None,"... moving up")

run("parser", input, interpreter=TestInterpreter, logger=log)
开发者ID:pombreda,项目名称:MoaT,代码行数:30,代码来源:mod_parser.py

示例11: InstallCommand

-
-        # make symlinks for test data
-        if build_cmd.build_lib != top_dir:
-            for path in ['testfiles.tar.gz', 'testtar.tar', 'gnupg']:
-                src = os.path.join(top_dir, 'testing', path)
-                target = os.path.join(build_cmd.build_lib, 'testing', path)
-                try:
-                    os.symlink(src, target)
-                except Exception:
-                    pass
-
-        os.environ['PATH'] = "%s:%s" % (
-            os.path.abspath(build_scripts_cmd.build_dir),
-            os.environ.get('PATH'))
-
-        test.run(self)
-
-
 class InstallCommand(install):
     def run(self):
-        # Normally, install will call build().  But we want to delete the
-        # testing dir between building and installing.  So we manually build
-        # and mark ourselves to skip building when we run() for real.
-        self.run_command('build')
-        self.skip_build = True
-
-        # This should always be true, but just to make sure!
-        if self.build_lib != top_dir:
-            testing_dir = os.path.join(self.build_lib, 'testing')
-            os.system("rm -rf %s" % testing_dir)
-
开发者ID:LambdaOS,项目名称:freebsd-ports,代码行数:31,代码来源:patch-setup.py

示例12: load_module

		log DEBUG Y what $what
	else:
		log ERROR N what $what
list on
trigger run test:
	param also two
	sync
wait :for 0.1
list on
trigger test me
wait :for 60
shutdown
"""

main_words.register_statement(DoNothingHandler)
main_words.register_statement(ShutdownHandler)
load_module("block")
load_module("trigger")
load_module("on_event")
load_module("exec")
load_module("ifelse")
load_module("bool")
load_module("data")
load_module("logging")
load_module("state")
load_module("wait")
load_module("amqp")

run("exec",input)

开发者ID:smurfix,项目名称:MoaT,代码行数:29,代码来源:mod_exec.py

示例13: run_tests

 def run_tests(self):
     import test
     errno = test.run()
     sys.exit(errno)
开发者ID:caje731,项目名称:semantic,代码行数:4,代码来源:setup.py

示例14: load_module

log DEBUG now we test a port that does not answer
async:
	connect wago localhost 59068:
		name test no_answer
		retry 0.12 0.5
		#ping 1
	
wait poll no_answer:
	for 1
	debug force
list wago server test no_answer
del wago server test no_answer
	
wait poll end:
	for 2
shutdown
"""

main_words.register_statement(DoNothingHandler)
main_words.register_statement(ShutdownHandler)
main_words.register_statement(Load)

load_module("block")
load_module("file")
load_module("ifelse")
load_module("path")
load_module("data")

run("wago",input)

开发者ID:smurfix,项目名称:MoaT,代码行数:29,代码来源:mod_wago.py

示例15: load_module

block:
	if last state two foo bar:
		log TRACE "Yes!"
	else:
		log TRACE "No‽ 6"
on whatever:
	var state x foo bar
	log TRACE We got $x
log DEBUG End1
trigger whatever :sync
log DEBUG End2
list state
log DEBUG End3
shutdown
log DEBUG End4
"""

main_words.register_statement(ShutdownHandler)
load_module("state")
load_module("block")
load_module("data")
load_module("on_event")
load_module("logging")
load_module("ifelse")
load_module("bool")
load_module("trigger")
load_module("errors")

run("persist1",input)

开发者ID:pombreda,项目名称:MoaT,代码行数:29,代码来源:mod_persist1.py


注:本文中的test.run函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。