Example #1
0
def run_tests(options, use_subprocess, cpython_restricted):
    print("Run tests with cpython_restricted=%s and use_subprocess=%s"
          % (cpython_restricted, use_subprocess))
    print("")
    createSandboxConfig.cpython_restricted = cpython_restricted
    createSandboxConfig.use_subprocess = use_subprocess

    # Get all tests
    all_tests = getTests(globals(), options.keyword)

    # Run tests
    nerror = 0
    nskipped = 0
    if version_info < (2, 6):
        base_exception = Exception
    else:
        base_exception = BaseException
    for func in all_tests:
        name = '%s.%s()' % (func.__module__.split('.')[-1], func.__name__)
        if options.debug:
            print(name)
        try:
            func()
        except SkipTest, skip:
            print("%s: skipped (%s)" % (name, skip))
            nskipped += 1
        except base_exception, err:
            nerror += 1
            print("%s: FAILED! %r" % (name, err))
            if options.raise_exception:
                raise
Example #2
0
def main():
    global createSandboxConfig

    options = parseOptions()
    createSandboxConfig.debug = options.debug

    print("Run the test suite on pysandbox %s with Python %s.%s"
          % (VERSION, version_info[0], version_info[1]))
    if not HAVE_CSANDBOX:
        print("WARNING: _sandbox module is missing")
    print

    # Get all tests
    all_tests = getTests(globals(), options.keyword)

    # Run tests
    nerror = 0
    if version_info < (2, 6):
        base_exception = Exception
    else:
        base_exception = BaseException
    for func in all_tests:
        name = '%s.%s()' % (func.__module__.split('.')[-1], func.__name__)
        try:
            func()
        except SkipTest, skip:
            print("%s: skipped (%s)" % (name, skip))
        except base_exception, err:
            nerror += 1
            print("%s: FAILED! %r" % (name, err))
            if options.raise_exception:
                raise
Example #3
0
def run_tests(options, use_subprocess, cpython_restricted):
    print("Run tests with cpython_restricted=%s and use_subprocess=%s" %
          (cpython_restricted, use_subprocess))
    print("")
    createSandboxConfig.cpython_restricted = cpython_restricted
    createSandboxConfig.use_subprocess = use_subprocess

    # Get all tests
    all_tests = getTests(globals(), options.keyword)

    # Run tests
    nerror = 0
    nskipped = 0
    if version_info < (2, 6):
        base_exception = Exception
    else:
        base_exception = BaseException
    for func in all_tests:
        name = '%s.%s()' % (func.__module__.split('.')[-1], func.__name__)
        if options.debug:
            print(name)
        try:
            func()
        except SkipTest, skip:
            print("%s: skipped (%s)" % (name, skip))
            nskipped += 1
        except base_exception, err:
            nerror += 1
            print("%s: FAILED! %r" % (name, err))
            if options.raise_exception:
                raise