Summary
libvcs's pytest plugin defines a session-scoped gitconfig fixture that returns a pathlib.Path. The third-party plugin pytest-gitconfig defines a fixture with the same name that returns a GitConfig helper object with a .set() method. When both plugins are installed and auto-loaded, libvcs wins fixture resolution and any downstream test that calls gitconfig.set(...) crashes:
AttributeError: 'PosixPath' object has no attribute 'set'
This was reported downstream against the Arch python-copier package, where the build runs upstream copier's tests with python -m venv --system-site-packages, exposing the system-installed python-libvcs plugin to the test environment: https://aur.archlinux.org/packages/python-copier#comment-1070264
Where the collision lives
- libvcs registers as the pytest plugin name
libvcs via [project.entry-points.pytest11] in pyproject.toml.
- The colliding fixture is
gitconfig in src/libvcs/pytest_plugin.py — session-scoped, returns pathlib.Path.
- A sibling
hgconfig fixture has the same shape and would collide with any equivalent third-party plugin.
The other fixtures in this module already use a vcs_ prefix (vcs_name, vcs_email, vcs_user); gitconfig / hgconfig are the outliers in that module's own naming convention.
Reproduction
$ pip install libvcs pytest-gitconfig
$ cat > test_collision.py <<'PYEOF'
def test_gitconfig_has_set(gitconfig):
gitconfig.set({"user.name": "x"})
PYEOF
$ pytest test_collision.py
# AttributeError: 'PosixPath' object has no attribute 'set'
$ pytest -p no:libvcs test_collision.py
# passes — pytest-gitconfig's fixture is now visible
Suggested fix
Rename libvcs's gitconfig and hgconfig fixtures to vacate the shared namespace — for example, vcs_gitconfig / vcs_hgconfig, matching the existing vcs_* convention. Internal references (set_gitconfig, git_repo, git_remote_repo, etc.) would be updated at the same time.
If keeping the short names is preferred, a deprecation alias (old name → new name with a DeprecationWarning) would let downstreams migrate without immediate breakage; once the old name is gone, the namespace is free.
I'm happy to send a PR if the rename direction is acceptable.
Workaround for downstream packagers
Until libvcs ships a fix, packagers whose test environment leaks libvcs in (e.g. python -m venv --system-site-packages) can disable just this plugin:
$ pytest -p no:libvcs ...
Summary
libvcs's pytest plugin defines a session-scoped
gitconfigfixture that returns apathlib.Path. The third-party pluginpytest-gitconfigdefines a fixture with the same name that returns aGitConfighelper object with a.set()method. When both plugins are installed and auto-loaded, libvcs wins fixture resolution and any downstream test that callsgitconfig.set(...)crashes:This was reported downstream against the Arch
python-copierpackage, where the build runs upstream copier's tests withpython -m venv --system-site-packages, exposing the system-installedpython-libvcsplugin to the test environment: https://aur.archlinux.org/packages/python-copier#comment-1070264Where the collision lives
libvcsvia[project.entry-points.pytest11]inpyproject.toml.gitconfiginsrc/libvcs/pytest_plugin.py— session-scoped, returnspathlib.Path.hgconfigfixture has the same shape and would collide with any equivalent third-party plugin.The other fixtures in this module already use a
vcs_prefix (vcs_name,vcs_email,vcs_user);gitconfig/hgconfigare the outliers in that module's own naming convention.Reproduction
Suggested fix
Rename libvcs's
gitconfigandhgconfigfixtures to vacate the shared namespace — for example,vcs_gitconfig/vcs_hgconfig, matching the existingvcs_*convention. Internal references (set_gitconfig,git_repo,git_remote_repo, etc.) would be updated at the same time.If keeping the short names is preferred, a deprecation alias (old name → new name with a
DeprecationWarning) would let downstreams migrate without immediate breakage; once the old name is gone, the namespace is free.I'm happy to send a PR if the rename direction is acceptable.
Workaround for downstream packagers
Until libvcs ships a fix, packagers whose test environment leaks libvcs in (e.g.
python -m venv --system-site-packages) can disable just this plugin:$ pytest -p no:libvcs ...