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


Python support.failfast方法代码示例

本文整理汇总了Python中test.support.failfast方法的典型用法代码示例。如果您正苦于以下问题:Python support.failfast方法的具体用法?Python support.failfast怎么用?Python support.failfast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.support的用法示例。


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

示例1: tests_and_args

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def tests_and_args():
            for test in tests:
                args_tuple = (
                    (test, verbose, quiet),
                    dict(huntrleaks=huntrleaks, use_resources=use_resources,
                         failfast=failfast,
                         match_tests=match_tests,
                         pgo=pgo)
                )
                yield (test, args_tuple) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:regrtest.py

示例2: local_runtest

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def local_runtest():
                result = runtest(test, verbose, quiet, huntrleaks, None, pgo,
                                 failfast=failfast,
                                 match_tests=match_tests,
                                 testdir=testdir)
                accumulate_result(test, result)
                return result 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:regrtest.py

示例3: run_test_in_subprocess

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def run_test_in_subprocess(testname, ns):
    """Run the given test in a subprocess with --slaveargs.

    ns is the option Namespace parsed from command-line arguments. regrtest
    is invoked in a subprocess with the --slaveargs argument; when the
    subprocess exits, its return code, stdout and stderr are returned as a
    3-tuple.
    """
    from subprocess import Popen, PIPE
    base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
                ['-X', 'faulthandler', '-m', 'test.regrtest'])
    # required to spawn a new process with PGO flag on/off
    if ns.pgo:
        base_cmd = base_cmd + ['--pgo']
    slaveargs = (
            (testname, ns.verbose, ns.quiet),
            dict(huntrleaks=ns.huntrleaks,
                 use_resources=ns.use_resources,
                 output_on_failure=ns.verbose3,
                 timeout=ns.timeout, failfast=ns.failfast,
                 match_tests=ns.match_tests, pgo=ns.pgo))
    # Running the child from the same working directory as regrtest's original
    # invocation ensures that TEMPDIR for the child is the same when
    # sysconfig.is_python_build() is true. See issue 15300.
    popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)],
                  stdout=PIPE, stderr=PIPE,
                  universal_newlines=True,
                  close_fds=(os.name != 'nt'),
                  cwd=support.SAVEDCWD)
    stdout, stderr = popen.communicate()
    retcode = popen.wait()
    return retcode, stdout, stderr 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:34,代码来源:regrtest.py

示例4: run_test_in_subprocess

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def run_test_in_subprocess(testname, ns):
    """Run the given test in a subprocess with --slaveargs.

    ns is the option Namespace parsed from command-line arguments. regrtest
    is invoked in a subprocess with the --slaveargs argument; when the
    subprocess exits, its return code, stdout and stderr are returned as a
    3-tuple.
    """
    from subprocess import Popen, PIPE
    base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
                ['-X', 'faulthandler', '-m', 'test.regrtest'])

    slaveargs = (
            (testname, ns.verbose, ns.quiet),
            dict(huntrleaks=ns.huntrleaks,
                 use_resources=ns.use_resources,
                 output_on_failure=ns.verbose3,
                 timeout=ns.timeout, failfast=ns.failfast,
                 match_tests=ns.match_tests))
    # Running the child from the same working directory as regrtest's original
    # invocation ensures that TEMPDIR for the child is the same when
    # sysconfig.is_python_build() is true. See issue 15300.
    popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)],
                  stdout=PIPE, stderr=PIPE,
                  universal_newlines=True,
                  close_fds=(os.name != 'nt'),
                  cwd=support.SAVEDCWD)
    stdout, stderr = popen.communicate()
    retcode = popen.wait()
    return retcode, stdout, stderr 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:32,代码来源:regrtest.py

示例5: main

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def main(tests=None, testdir=None, verbose=0, quiet=False,
         exclude=False, single=False, randomize=False, fromfile=None,
         findleaks=False, use_resources=None, trace=False, coverdir='coverage',
         runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
         random_seed=None, use_mp=None, verbose3=False, forever=False,
         header=False, pgo=False, failfast=False, match_tests=None):
    """Execute a test suite.

    This also parses command-line options and modifies its behavior
    accordingly.

    tests -- a list of strings containing test names (optional)
    testdir -- the directory in which to look for tests (optional)

    Users other than the Python test suite will certainly want to
    specify testdir; if it's omitted, the directory containing the
    Python test suite is searched for.

    If the tests argument is omitted, the tests listed on the
    command-line will be used.  If that's empty, too, then all *.py
    files beginning with test_ will be used.

    The other default arguments (verbose, quiet, exclude,
    single, randomize, findleaks, use_resources, trace, coverdir,
    print_slow, and random_seed) allow programmers calling main()
    directly to set the values that would normally be set by flags
    on the command line.
    """
    regrtest_start_time = time.time()

    support.record_original_stdout(sys.stdout)
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:j:PGm:',
            ['help', 'verbose', 'verbose2', 'verbose3', 'quiet',
             'exclude', 'single', 'slow', 'slowest', 'randomize', 'fromfile=',
             'findleaks',
             'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
             'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
             'multiprocess=', 'slaveargs=', 'forever', 'header', 'pgo',
             'failfast', 'match=', 'testdir=', 'list-tests', 'list-cases',
             'coverage', 'matchfile=', 'fail-env-changed', 'cleanup'])
    except getopt.error, msg:
        usage(2, msg)

    # Defaults 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:47,代码来源:regrtest.py

示例6: runtest

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import failfast [as 别名]
def runtest(test, verbose, quiet,
            huntrleaks=False, use_resources=None, pgo=False,
            failfast=False, match_tests=None, testdir=None):
    """Run a single test.

    test -- the name of the test
    verbose -- if true, print more messages
    quiet -- if true, don't print 'skipped' messages (probably redundant)
    test_times -- a list of (time, test_name) pairs
    huntrleaks -- run multiple times to test for leaks; requires a debug
                  build; a triple corresponding to -R's three arguments
    pgo -- if true, do not print unnecessary info when running the test
           for Profile Guided Optimization build

    Returns one of the test result constants:
        CHILD_ERROR      Child process crashed
        INTERRUPTED      KeyboardInterrupt when run under -j
        RESOURCE_DENIED  test skipped because resource denied
        SKIPPED          test skipped for some other reason
        ENV_CHANGED      test failed because it changed the execution environment
        FAILED           test failed
        PASSED           test passed
        EMPTY_TEST_SUITE test ran no subtests.
    """

    support.verbose = verbose  # Tell tests to be moderately quiet
    if use_resources is not None:
        support.use_resources = use_resources
    try:
        support.set_match_tests(match_tests)
        # reset the environment_altered flag to detect if a test altered
        # the environment
        support.environment_altered = False
        if failfast:
            support.failfast = True

        return runtest_inner(test, verbose, quiet, huntrleaks, pgo, testdir)
    finally:
        cleanup_test_droppings(test, verbose)


# Unit tests are supposed to leave the execution environment unchanged
# once they complete.  But sometimes tests have bugs, especially when
# tests fail, and the changes to environment go on to mess up other
# tests.  This can cause issues with buildbot stability, since tests
# are run in random order and so problems may appear to come and go.
# There are a few things we can save and restore to mitigate this, and
# the following context manager handles this task. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:50,代码来源:regrtest.py


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