def test_init_git_repo(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.init_git_repo(self.tempdir) self.assertTrue(os.path.isdir(os.path.join(self.tempdir, '.git'))) # InitGitRepo should work on existing git repositories too. source_package.init_git_repo(self.tempdir)
def test_run_git_cmd_bad_repo(self): os.mkdir(os.path.join(self.tempdir, '.git')) with self.assertRaisesRegexp(error.Error, 'git command failed'): source_package.init_git_repo(self.tempdir)