v0.16.0 - pytest plugin
via #409
libvcs now provides a test rig for local repositories. It automatically can provide clean local repositories and working copies for git, svn, and mercurial. They are automatically cleaned up after each test.
It works by bootstrapping a temporary $HOME environment in a TmpPathFactory for automatic cleanup.
import pathlib
from libvcs.pytest_plugin import CreateProjectCallbackFixtureProtocol
from libvcs.sync.git import GitSync
def test_repo_git_remote_checkout(
create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
tmp_path: pathlib.Path,
projects_path: pathlib.Path,
) -> None:
git_server = create_git_remote_repo()
git_repo_checkout_dir = projects_path / "my_git_checkout"
git_repo = GitSync(dir=str(git_repo_checkout_dir), url=f"file://{git_server!s}")
git_repo.obtain()
git_repo.update_repo()
assert git_repo.get_revision() == "initial"
assert git_repo_checkout_dir.exists()
assert pathlib.Path(git_repo_checkout_dir / ".git").exists()Learn more on the docs at https://libvcs.git-pull.com/pytest-plugin.html
Full Changelog: v0.15.0...v0.16.0