Exemplo n.º 1
0
    def testInitGitRepo(self):
        # init a git repo containing a single dummy file
        with open(os.path.join(self.tempdir, 'file'), 'w') as f:
            f.write('bar')
        source_package.InitGitRepo(self.tempdir)
        self.assertTrue(os.path.isdir(os.path.join(self.tempdir, '.git')))

        # InitGitRepo should work on existing git repositories too.
        source_package.InitGitRepo(self.tempdir)
Exemplo n.º 2
0
 def testRunGitCmd_BadRepo(self):
     os.mkdir(os.path.join(self.tempdir, '.git'))
     with self.assertRaisesRegexp(error.Error, 'git command failed'):
         source_package.InitGitRepo(self.tempdir)