Beispiel #1
0
    def test_fetch_unknown(self):
        """Test whether commits are properly processed"""

        cl = CoLang('http://example.com', self.git_path, tag="test")

        with self.assertRaises(GraalError):
            _ = cl.fetch(category="unknown")
Beispiel #2
0
    def test_fetch_cloc(self):
        """Test whether commits are properly processed"""

        cl = CoLang('http://example.com', self.git_path, tag="test")
        commits = [
            commit for commit in cl.fetch(category=CATEGORY_COLANG_CLOC)
        ]

        self.assertEqual(len(commits), 6)
        self.assertFalse(os.path.exists(cl.worktreepath))

        commit = commits[0]
        self.assertEqual(commit['backend_name'], 'CoLang')
        self.assertEqual(commit['category'], CATEGORY_COLANG_CLOC)
        results = commit['data']['analysis']
        result = results[next(iter(results))]

        self.assertIn('blanks', result)
        self.assertTrue(type(result['blanks']), int)
        self.assertIn('comments', result)
        self.assertTrue(type(result['comments']), int)
        self.assertIn('loc', result)
        self.assertTrue(type(result['loc']), int)
        self.assertIn('total_files', result)
        self.assertTrue(type(result['total_files']), int)
Beispiel #3
0
    def test_fetch_linguist(self):
        """Test whether commits are properly processed"""

        cl = CoLang('http://example.com', self.git_path, tag="test")
        commits = [commit for commit in cl.fetch()]

        self.assertEqual(len(commits), 6)
        self.assertFalse(os.path.exists(cl.worktreepath))

        commit = commits[0]
        self.assertEqual(commit['backend_name'], 'CoLang')
        self.assertEqual(commit['category'], CATEGORY_COLANG_LINGUIST)
        result = commit['data']['analysis']
        self.assertNotIn('breakdown', result)