Beispiel #1
0
def find_and_initialize_tests():
    mapping = {}
    for f in glob.glob(os.path.join(cwd, "*.py")):
        clear_registry()
        iname = os.path.basename(f[:-3])
        try:
            load_tests(iname, cwd)
            mapping[iname] = registry_entries()
            #print "Associating %s with" % (iname)
            #print "\n    ".join(registry_entries())
        except ImportError:
            pass
    return mapping
Beispiel #2
0
                      default=None,
                      help="The name against which we will compare")
    parser.add_option("-n",
                      "--name",
                      dest="this_name",
                      default=my_hash,
                      help="The name we'll call this set of tests")
    opts, args = parser.parse_args()

    if opts.list_tests:
        tests_to_run = []
        for m, vals in mapping.items():
            new_tests = fnmatch.filter(vals, opts.test_pattern)
            if len(new_tests) == 0: continue
            load_tests(m, cwd)
            keys = set(registry_entries())
            tests_to_run += [t for t in new_tests if t in keys]
        tests = list(set(tests_to_run))
        print("\n    ".join(tests))
        sys.exit(0)

    # Load the test ds and make sure it's good.
    ds = load(opts.parameter_file)
    if ds is None:
        print "Couldn't load the specified parameter file."
        sys.exit(1)

    # Now we modify our compare name and self name to include the ds.
    compare_id = opts.compare_name
    watcher = None
    if compare_id is not None: