def test_git_sym(self): create_watcher = get_fallback_create_watcher() dotgit = os.path.join(GIT_REPO, '.git') spacegit = os.path.join(GIT_REPO, ' .git ') os.rename(dotgit, spacegit) try: with open(dotgit, 'w') as F: F.write('gitdir: .git \n') gitdir = git_directory(GIT_REPO) self.assertTrue(os.path.isdir(gitdir)) self.assertEqual(gitdir, os.path.abspath(spacegit)) repo = guess(path=GIT_REPO, create_watcher=create_watcher) self.assertEqual(repo.branch(), 'master') finally: os.remove(dotgit) os.rename(spacegit, dotgit)