示例#1
0
def run_grammar_tests(glob_pattern, get_grammar, get_transformer):
    DHParser.log.start_logging(LOGGING)
    error_report = testing.grammar_suite(
        os.path.join(scriptpath, 'test_grammar'),
        get_grammar, get_transformer,
        fn_patterns=[glob_pattern], report='REPORT', verbose=True)
    return error_report
示例#2
0
def run_grammar_tests(glob_pattern):
    test_path = os.path.join(fullpath, 'test_grammar')
    DHParser.log.start_logging(os.path.join(test_path, 'LOGS'))
    error_report = testing.grammar_suite(
        test_path, get_grammar, get_transformer, fn_patterns=[glob_pattern], report='REPORT',
        verbose=True)
    return error_report
示例#3
0
def run_grammar_tests(glob_pattern):
    error_report = testing.grammar_suite(os.path.join(scriptpath,
                                                      'test_grammar'),
                                         get_grammar,
                                         get_transformer,
                                         fn_patterns=[glob_pattern],
                                         verbose=True)
    return error_report
def run_grammar_tests(glob_pattern, get_grammar, get_transformer):
    testdir = os.path.join(scriptpath, TEST_DIRNAME)
    DHParser.log.start_logging(os.path.join(testdir, LOGGING))
    error_report = testing.grammar_suite(testdir,
                                         get_grammar,
                                         get_transformer,
                                         fn_patterns=[glob_pattern],
                                         report='REPORT',
                                         verbose=True)
    return error_report
示例#5
0
if __name__ == "__main__":
    configuration.access_presets()
    configuration.set_preset_value('test_parallelization', True)
    configuration.finalize_presets()
    if not DHParser.dsl.recompile_grammar(
            'BibTeX.ebnf',
            force=False):  # recompiles Grammar only if it has changed
        print(
            '\nErrors while recompiling "BibTeX.ebnf":\n--------------------------------------\n\n'
        )
        with open('BibTeX_ebnf_ERRORS.txt') as f:
            print(f.read())
        sys.exit(1)

    sys.path.append('.')
    # must be appended after module creation, because otherwise an ImportError is raised under Windows

    from BibTeXParser import get_grammar, get_transformer

    error_report = testing.grammar_suite('test_grammar',
                                         get_grammar,
                                         get_transformer,
                                         report='REPORT',
                                         verbose=True)
    if error_report:
        print('\n')
        print(error_report)
        sys.exit(1)
    else:
        print('\nSUCCESS! All tests passed :-)')