Ejemplo n.º 1
0
def ci():
    os.chdir(root_directory)
    ci_discoverer = CiDiscoverer()
    try:
        os.chdir(root_directory)
        result = ci_discoverer.discover(repo_path+repoName)
        if(result == True):
            val = (str(int(result)),repo_id)
            QUERY = '''UPDATE `repoquester_results` SET `continuous_integration`=? WHERE `repo_id`=?'''
            try:
                os.chdir(root_directory)
                conn = sqlite3.connect('repo_quester.db',timeout=180)
                conn.execute(QUERY,val)
                conn.commit()
                print('CI: ',result)
                conn.close()
            except Exception as ex:
                print(ex)
                os.chdir(root_directory)
                conn = sqlite3.connect('repo_quester.db',timeout=180)
                conn.execute(QUERY,val)
                conn.commit()
                print('CI: ',result,' >> trying again.. ok')
                conn.close()
    except Exception as ex:
        print(ex)
Ejemplo n.º 2
0
    def test_discover(self):
        # Test: Mocking no services configured
        ci_discoverer_mock = CiDiscoverer()
        ci_discoverer_mock.services = None

        self.assertRaises(Exception, ci_discoverer_mock.discover, path='')

        # Test: Project with Travis CI
        self.assertTrue(
            self.ci_discoverer.discover(os.path.join(REPOS_PATH, 'squib')))

        # Test: Project with AppVeyor
        self.assertTrue(
            self.ci_discoverer.discover(os.path.join(REPOS_PATH, 'grunt')))

        # Test: Project with both Travis CI and AppVeyor
        self.assertTrue(
            self.ci_discoverer.discover(os.path.join(REPOS_PATH, 'grunt')))

        # Test: Project with no CI (when these tests were written)
        self.assertFalse(
            self.ci_discoverer.discover(os.path.join(REPOS_PATH, 'django')))
Ejemplo n.º 3
0
import os
import sys

from attributes.continuous_integration.discoverer import CiDiscoverer

ci_discoverer = CiDiscoverer()


def run(project_id, repo_path, cursor, **options):
    result = ci_discoverer.discover(repo_path)
    return (int(result), result)


if __name__ == '__main__':
    print('Attribute plugins are not meant to be executed directly.')
    sys.exit(1)
Ejemplo n.º 4
0
 def setUp(self):
     self.ci_discoverer = CiDiscoverer()