Beispiel #1
0
def main():
    option_parser = optparse.OptionParser(
        usage="%prog [options] [filenames]",
        description="py2js unittests script.")
    option_parser.add_option(
        "-a",
        "--run-all",
        action="store_true",
        dest="run_all",
        default=False,
        help="run all tests (including the known-to-fail)")
    option_parser.add_option(
        "-x",
        "--no-error",
        action="store_true",
        dest="no_error",
        default=False,
        help="ignores error( don't display them after tests)")
    options, args = option_parser.parse_args()
    runner = testtools.runner.Py2JsTestRunner(verbosity=2)
    results = None
    if options.run_all:
        results = runner.run(testtools.tests.ALL)
    elif args:
        results = runner.run(testtools.tests.get_tests(args))
    else:
        results = runner.run(testtools.tests.NOT_KNOWN_TO_FAIL)
    if not options.no_error and results.errors:
        print
        print "errors:"
        print "  (use -x to skip this part)"
        for test, error in results.errors:
            print
            print "*", str(test), "*"
            print error
Beispiel #2
0
def main():
    installHandler()
    option_parser = optparse.OptionParser(
        usage="%prog [options] [filenames]",
        description="pyjaco unittests script."
        )
    option_parser.add_option(
        "-a",
        "--run-all",
        action="store_true",
        dest="run_all",
        default=False,
        help="run all tests (including the known-to-fail)"
        )
    option_parser.add_option(
        "-x",
        "--no-error",
        action="store_true",
        dest="no_error",
        default=False,
        help="ignores error (don't display them after tests)"
        )
    option_parser.add_option(
        "-f",
        "--only-failing",
        action="store_true",
        dest="only_failing",
        default=False,
        help="run only failing tests (to check for improvements)"
        )
    options, args = option_parser.parse_args()
    
    with open("py-builtins.js", "w") as f:
        builtins = BuiltinGenerator().generate_builtins()
        f.write(builtins)
    
    runner = testtools.runner.Py2JsTestRunner(verbosity=2)
    results = None
    try:
        if options.run_all:
            results = runner.run(testtools.tests.ALL)
        elif options.only_failing:
            results = runner.run(testtools.tests.KNOWN_TO_FAIL)
        elif args:
            results = runner.run(testtools.tests.get_tests(args))
        else:
            results = runner.run(testtools.tests.NOT_KNOWN_TO_FAIL)
    except KeyboardInterrupt:
        pass
    if not options.no_error and results and results.errors:
        print
        print "errors:"
        print "  (use -x to skip this part)"
        for test, error in results.errors:
            print
            print "*", str(test), "*"
            print error
Beispiel #3
0
def main():
    installHandler()
    option_parser = optparse.OptionParser(
        usage="%prog [options] [filenames]",
        description="pyjaco unittests script.")
    option_parser.add_option(
        "-a",
        "--run-all",
        action="store_true",
        dest="run_all",
        default=False,
        help="run all tests (including the known-to-fail)")
    option_parser.add_option(
        "-x",
        "--no-error",
        action="store_true",
        dest="no_error",
        default=False,
        help="ignores error (don't display them after tests)")
    option_parser.add_option(
        "-f",
        "--only-failing",
        action="store_true",
        dest="only_failing",
        default=False,
        help="run only failing tests (to check for improvements)")
    options, args = option_parser.parse_args()
    runner = testtools.runner.Py2JsTestRunner(verbosity=2)
    results = None
    try:
        if options.run_all:
            results = runner.run(testtools.tests.ALL)
        elif options.only_failing:
            results = runner.run(testtools.tests.KNOWN_TO_FAIL)
        elif args:
            results = runner.run(testtools.tests.get_tests(args))
        else:
            results = runner.run(testtools.tests.NOT_KNOWN_TO_FAIL)
    except KeyboardInterrupt:
        pass
    if not options.no_error and results and results.errors:
        print
        print "errors:"
        print "  (use -x to skip this part)"
        for test, error in results.errors:
            print
            print "*", str(test), "*"
            print error
Beispiel #4
0
def main():
    option_parser = optparse.OptionParser(
        usage="%prog [options] [filenames]",
        description="py2js unittests script."
        )
    option_parser.add_option(
        "-a",
        "--run-all",
        action="store_true",
        dest="run_all",
        default=False,
        help="run all tests (including the known-to-fail)"
        )
    option_parser.add_option(
        "-x",
        "--no-error",
        action="store_true",
        dest="no_error",
        default=False,
        help="ignores error( don't display them after tests)"
        )
    options, args = option_parser.parse_args()
    runner = testtools.runner.Py2JsTestRunner(verbosity=2)
    results = None
    if options.run_all:
        results = runner.run(testtools.tests.ALL)
    elif args:
        results = runner.run(testtools.tests.get_tests(args))
    else:
        results = runner.run(testtools.tests.NOT_KNOWN_TO_FAIL)
    if not options.no_error and results.errors:
        print
        print "errors:"
        print "  (use -x to skip this part)"
        for test, error in results.errors:
            print
            print "*", str(test), "*"
            print error