Ejemplo n.º 1
0
def set_tests(tests=''):
    """
        Sets the gluster_tests Test class with the test cases.
        Name of the tests will be prepended with test_ to enable
        unittest to recognise them as test case
    """
    if tests == '':
        tests = testcases.keys()
    if test_list == {}:
        test_list[''] = testcases.keys()
    i = 0
    for voltype, vol_tests in test_list.iteritems():
        for test in vol_tests:
            if test in tests:
                if test not in test_mounts:
                    test_mounts[test] = ['']
                for mount in test_mounts[test]:
                    try:
                        setattr(gluster_tests, "test_%d_%s_%s_%s" % \
                                (i, voltype, mount, test), testcases[test])
                        i = i + 1
                        test_seq.append((voltype, mount))
                    except KeyError:
                        sys.stderr.write("Unable to find test %s." \
                                         "Skipping...\n" % test)
Ejemplo n.º 2
0
def set_tests(tests=[]):
    """
        Sets the gluster_tests Test class with the test cases.
        Name of the tests will be prepended with test_ to enable
        unittest to recognise them as test case
    """
    if tests == []:
        tests = testcases.keys()
    else:
        for name in testcases.keys():
            if name not in tests:
                del testcases[name]
    i = 0
    for test in tests:
        try:
            setattr(gluster_tests, "test_%d_%s" % (i, test), testcases[test])
            i = i + 1
        except KeyError:
            sys.stderr.write("Unable to find test %s. Skipping it...\n" % test)