예제 #1
0
def main(args):
    os.chdir(ROOT_DIR)
    report = Report(enable_colors=os.isatty(sys.stdout.fileno()))
    if args:
        check_file(report, args[0])
    else:
        for root in DIRS:
            traverse(report, root, EXCLUDES)
    report.output()
예제 #2
0
파일: tests.py 프로젝트: AdaCore/libadalang
def test_report_output():
    """
    Just to cover output-related code, this trivial feature itself is not
    tested otherwise.
    """
    with open(os.devnull, 'w') as f:
        for enable_colors in (False, True):
            r = Report(enable_colors, f)
            r.add('Foobar')
            r.output()
예제 #3
0
def test_report_output():
    """
    Just to cover output-related code, this trivial feature itself is not
    tested otherwise.
    """
    with open(os.devnull, 'w') as f:
        for enable_colors in (False, True):
            r = Report(enable_colors, f)
            r.add('Foobar')
            r.output()
예제 #4
0
    def test():
        # Pre-process content
        report = Report(enable_colors=False)
        content = reindent_content(tc)
        check_file_content(report, tc.filename, content)
        records = [(tc.filename, ) + rec for rec in tc.records]

        def fmt_records(records):
            return ('\n'.join(
                '  {}:{}: {}'.format(*rec)
                for rec in records) if records else '  <no report>')

        assert report.records == records, (
            'For the following source:\n'
            '{}\n'
            'Got the following report:\n'
            '{}\n'
            'But the following was expected instead:\n'
            '{}'.format(
                '\n'.join('    {}'.format(line)
                          for line in content.split('\n')),
                fmt_records(report.records), fmt_records(records)))