def _create_empty_repository(cls, backend_alias=None): Backend = get_backend(backend_alias or cls.backend_alias) repo_path = get_new_dir(str(time.time())) repo = Backend(repo_path, create=True) if hasattr(cls, '_get_commits'): cls.tip = _add_commits_to_repo(repo, cls._get_commits()) return repo
def vcs_repo(request, backend_alias): Backend = get_backend(backend_alias) repo_path = get_new_dir(str(time.time())) repo = Backend(repo_path, create=True) @request.addfinalizer def cleanup(): shutil.rmtree(repo_path) return repo
def test_create_bare_repo(self): repo = GitRepository(get_new_dir('bare-repo'), create=True, bare=True) assert repo.bare
def test_create_repo_is_not_bare_by_default(self): repo = GitRepository(get_new_dir('not-bare-by-default'), create=True) assert not repo.bare
def test_get_commits_on_empty_repo_raises_EmptyRepository_error(self): repo_path = get_new_dir(str(time.time())) repo = self.Backend(repo_path, create=True) with pytest.raises(EmptyRepositoryError): list(repo.get_commits(start_id='foobar'))