예제 #1
0
    def test_reuse_existing(self):
        desc = KojiRepoDescriptor('primary', 'build_tag', 1)
        with patch('koschei.backend.repo_util.load_sack') as load_sack:
            cache = repo_cache.RepoCache()
            with cache.get_sack(desc) as sack:
                pass
            load_sack.assert_called_once_with('./repodata', desc, download=True)
            self.assertIs(load_sack(), sack)
            load_sack.reset_mock()

            # instantiate new cache
            cache = repo_cache.RepoCache()
            with cache.get_sack(desc) as sack:
                pass
            load_sack.assert_called_once_with('./repodata', desc)
            self.assertIs(load_sack(), sack)
예제 #2
0
 def test_read_from_disk(self):
     with patch('koschei.backend.repo_util.load_sack') as load_sack:
         cache = repo_cache.RepoCache()
         with cache.get_sack(self.descriptors[666]) as sack:
             pass
         load_sack.assert_called_once_with('./repodata', self.descriptors[666])
         self.assertIs(load_sack(), sack)
예제 #3
0
 def test_download(self):
     with patch('koschei.backend.repo_util.load_sack') as load_sack:
         cache = repo_cache.RepoCache()
         desc = KojiRepoDescriptor('primary', 'build_tag', 1)
         with cache.get_sack(desc) as sack:
             pass
         load_sack.assert_called_once_with('./repodata', desc, download=True)
         self.assertIs(load_sack(), sack)
예제 #4
0
def main():
    if not os.path.exists('/tmp/maven-modulemd-gen/repodata'):
        os.makedirs('/tmp/maven-modulemd-gen/repodata')
    for module_coords in config.get_config('module_excludes', []):
        excludes.extend(get_module_components(*module_coords))
    log.info('Loading sack...')
    with repo_cache.RepoCache().get_sack(repo_descriptor) as sack:
        work(sack)
예제 #5
0
 def test_reuse(self):
     cache = repo_cache.RepoCache()
     with mocks() as (librepo_mock, _):
         cache.get_sack(repo_cache.RepoDescriptor('primary', 'build_tag',
                                                  1))
     with mocks() as (librepo_mock, _):
         cache.get_sack(repo_cache.RepoDescriptor('primary', 'build_tag',
                                                  1))
         # In-memory caching of sacks is not supported any longer
         self.assertEqual(1, librepo_mock.perform.call_count)
예제 #6
0
 def test_read_from_disk(self):
     with mocks() as (librepo_mock, sack_mock):
         cache = repo_cache.RepoCache()
         sack = cache.get_sack(self.descriptors[666])
         self.assertIs(True, librepo_mock.local)
         # pylint:disable=no-member
         self.assertIs(librepo.LR_YUMREPO, librepo_mock.repotype)
         self.assertEqual(['primary', 'filelists', 'group'],
                          librepo_mock.yumdlist)
         self.assertEqual('./repodata/primary-build_tag-666',
                          librepo_mock.urls[0])
         self.assertEqual(1, librepo_mock.perform.call_count)
         self.assertIs(sack_mock, sack)
예제 #7
0
 def test_download(self):
     with mocks() as (librepo_mock, _):
         cache = repo_cache.RepoCache()
         cache.get_sack(repo_cache.RepoDescriptor('primary', 'build_tag',
                                                  1))
         self.assertEqual(2, librepo_mock.perform.call_count)
예제 #8
0
def main():
    if not os.path.exists('/tmp/maven-modulemd-gen/repodata'):
        os.makedirs('/tmp/maven-modulemd-gen/repodata')
    log.info('Loading sack...')
    with repo_cache.RepoCache().get_sack(repo_descriptor) as sack:
        work(sack)