Пример #1
0
    def test_output_html(self):
        # Set options
        opts = __parse_arguments__(args=['--grading', '--legacy',
                                         '--file-types', '*.c,*.h',
                                         '--format', 'html',
                                         'build/tests/trie-repository'])
        opts.progress = False

        # Launch runner
        localization.init_null()
        file = tempfile.NamedTemporaryFile('w', delete=False)
        r = Runner(opts, FileWriter(file))
        r.process()
        with open(file.name, 'r') as f:
            contents = f.read()
            self.assertTrue("Statistical information" in contents)
            self.assertTrue("The following history timeline" in contents)
        os.remove(file.name)
    def test_output_json(self):
        # Set options
        opts = __parse_arguments__(args=[
            '--grading', '--legacy', '--file-types', '*.py', '--format',
            'json', 'build/tests/pelican-repository'
        ])
        opts.progress = False

        # Launch runner
        localization.init_null()
        file = tempfile.NamedTemporaryFile('w', delete=False)
        r = Runner(opts, FileWriter(file))
        r.process()
        with open(file.name, 'r') as f:
            contents = f.read()
            self.assertTrue("The following historical commit" in contents)
            self.assertTrue("Below are the number of rows" in contents)
            self.assertTrue("The following history timeline" in contents)
        os.remove(file.name)
Пример #3
0
    def test_output_xml(self):
        # Set options
        opts = __parse_arguments__(args=[
            '--grading', '--legacy', '--file-types', '*.c,*.txt', '--exclude',
            'author:Abraham Lincoln', '--since', '2001-01-01', '--until',
            '2020-01-01', '--format', 'xml', 'build/tests/basic-repository'
        ])
        opts.progress = False

        # Launch runner
        localization.init_null()
        file = tempfile.NamedTemporaryFile('w', delete=False)
        r = Runner(opts, FileWriter(file))
        r.process()
        with open(file.name, 'r') as f:
            contents = f.read()
            self.assertTrue("The following historical commit" in contents)
            self.assertTrue("Below are the number of rows" in contents)
            self.assertTrue("The following history timeline" in contents)
        os.remove(file.name)
Пример #4
0
    def test_output_text(self):
        # Set options
        opts = __parse_arguments__(args=[
            '--grading', '--legacy', '--file-types', '.*\.c,.*\.txt',
            '--exclude', 'author:John Doe', '--format', 'text',
            'build/tests/basic-repository'
        ])
        opts.progress = False

        # Launch runner
        localization.init_null()
        file = tempfile.NamedTemporaryFile('w', delete=False)
        r = Runner(opts, FileWriter(file))
        r.process()
        with open(file.name, 'r') as f:
            contents = f.read()
            self.assertTrue("Statistical information" in contents)
            self.assertTrue("The following historical commit" in contents)
            self.assertTrue("Below are the number of rows" in contents)
        os.remove(file.name)