(pytest_plugin)=
:::{doc-pytest-plugin} libvcs.pytest_plugin :project: libvcs :package: libvcs :summary: libvcs ships a pytest plugin for creating isolated Git, Mercurial, and Subversion repositories during tests. :tests-url: https://github.com/vcs-python/libvcs/tree/master/tests
Use these fixtures when your tests need disposable repositories, config files, and home-directory setup without repeating bootstrap code in every suite.
These fixtures are the usual starting point when enabling the plugin:
- {fixture}
set_homepatches$HOMEto point at {fixture}user_path. - {fixture}
set_vcs_gitconfigand {fixture}set_vcs_hgconfigapply stable VCS configuration. - {fixture}
vcs_name, {fixture}vcs_email, and {fixture}vcs_userlet you override commit identity defaults. - {fixture}
git_commit_envvarshelps when Git ignoresGIT_CONFIGin a subprocess-heavy test.
Keep autouse setup explicit in your own conftest.py instead of having the
plugin force global side effects.
import pytest
@pytest.fixture(autouse=True)
def setup(
set_home: None,
set_vcs_gitconfig: None,
set_vcs_hgconfig: None,
) -> None:
pass:::
.. autodata:: libvcs.pytest_plugin.GitCommitEnvVars
.. autoclass:: libvcs.pytest_plugin.CreateRepoFn
:special-members: __call__
:exclude-members: __init__, _abc_impl, _is_protocol
.. autoclass:: libvcs.pytest_plugin.CreateRepoPostInitFn
:special-members: __call__
:exclude-members: __init__, _abc_impl, _is_protocol