Пример #1
0
 async def test_ls_remote_forever(self):
     '''
     Test case for a repo which hangs for a long time to make sure we git
     ls-remote eventually.
     '''
     git = Git(self.tempdir)
     self.assertFalse(await git.ls_remote('git://java.net/jax-rs-spec~api'))
Пример #2
0
 async def test_infer_main_branch(self):
     gitdir = self.tempdir.mktempdir()
     subprocess.check_output(['git', 'init'], cwd=gitdir)
     with open(os.path.join(gitdir, 'README.md'), 'w') as handle:
         handle.write('# Hello World')
     subprocess.check_output(['git', 'add', '-A'], cwd=gitdir)
     subprocess.check_output(['git', 'checkout', '-b', 'v2'], cwd=gitdir)
     subprocess.check_output(['git', 'commit', '-m', 'Initial Commit'],
                             cwd=gitdir)
     for src_url, branch in [(self.gcreated, 'master'), (gitdir, 'v2')]:
         git = Git(self.tempdir)
         with self.subTest(src_url=src_url, branch=branch):
             self.assertTrue(await git.clone(src_url))
             self.assertEqual(git.main_branch, branch)
             shutil.rmtree(git.cwd, ignore_errors=True)
Пример #3
0
 async def test_ls_remote_svn(self):
     git = Git(self.tempdir)
     self.assertTrue(
         await
         git.ls_remote('https://svn.code.sf.net/p/lame/svn/trunk/lame'))
Пример #4
0
 async def test_ls_remote(self):
     git = Git(self.tempdir)
     self.assertTrue(await git.ls_remote(self.gcreated))
Пример #5
0
 async def test_ls_remote_no_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.ls_remote(str(random.random())))
Пример #6
0
 async def test_not_a_git_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.clone('https://example.com'))
     self.assertFalse(os.path.isdir(git.cwd))
Пример #7
0
 async def test_no_repo(self):
     git = Git(self.tempdir)
     self.assertFalse(await git.clone(str(random.random())))
     self.assertFalse(os.path.isdir(git.cwd))
Пример #8
0
 async def test_git_clone_svn(self):
     git = Git(self.tempdir)
     self.assertTrue(
         len(await
             git.clone('https://svn.code.sf.net/p/lame/svn/trunk/lame')))
     shutil.rmtree(git.cwd, ignore_errors=True)
Пример #9
0
 async def test_git_clone(self):
     git = Git(self.tempdir)
     self.assertTrue(await git.clone(self.gcreated))
     shutil.rmtree(git.cwd, ignore_errors=True)