Пример #1
0
def _create_decode_classes():
    """
    Return a dictionary of testcase objects for each of the example specification files.
    """
    testdir = os.path.dirname(__file__)
    path = os.path.join(testdir, '..')
    result = {}
    config = ConfigParser()
    config.read(os.path.join(os.path.dirname(__file__), 'fixme.cfg'))
    for filename in glob.glob(os.path.join(path, '*.xml')):
        # Create a test class per specification, which each sample file being
        # a test method.
        name = os.path.splitext(os.path.split(filename)[1])[0]

        datadir = os.path.join(testdir, name)
        tests = []
        if os.path.exists(datadir):
            for datafile in os.listdir(datadir):
                tests.append((
                    datafile[:datafile.index('.')],
                    filename,
                    None,
                    [os.path.join(datadir, datafile)],
                    []))

        result.update(create_classes(name, tests, config))
    assert result, "No example specifications found!"
    return result
Пример #2
0
def _create_test_cases():
    """Create a set of test cases based for the specs in the regression folder.

    Each folder in the regression directory contains specifications and data
    files to test.

    return -- A dictionary of name to test class.
    """
    config = ConfigParser()
    config.read(os.path.join(os.path.dirname(__file__), 'fixme.cfg'))

    result = {}
    regression_dir = os.path.dirname(__file__)
    for name in os.listdir(regression_dir):
        path = os.path.join(regression_dir, name)
        if os.path.isdir(path):
            result.update(create_classes(name, _find_regression_tests(name, path), config))
    return result