Description
In test_git.py
, TestGit.test_refresh
tests the behavior of git.refresh
when called with bad (nonexistent) and good (existing and usable) explicit path
arguments.
- With the bad path, there could only be a lasting change to
Git.GIT_PYTHON_GIT_EXECUTABLE
or other global state due to a bug ingit.refresh
, or ingit.cmd.Git.refresh
or some other codegit.refresh
uses. - But with the good path, it remains set as
Git.GIT_PYTHON_GIT_EXECUTABLE
, and tests that run aftertest_refresh
use that instead of the original value that (when tests are run normally in an environment that supports them) is usually"git"
.
Lines 309 to 316 in 307f198
>>> from git import Git
>>> from test.test_git import TestGit
>>> t = TestGit()
>>> Git.GIT_PYTHON_GIT_EXECUTABLE
'git'
>>> t.test_refresh()
>>> Git.GIT_PYTHON_GIT_EXECUTABLE
'C:\\Users\\ek\\scoop\\shims\\git.exe'
(That was run on Windows, but the effect is not specific to Windows.)
Although the good-path code can be simplified in the way it finds the absolute path it tests, that is not the cause of this.
In the absence of bugs in the code under test, this change to Git.GIT_PYTHON_GIT_EXECUTABLE
between some tests and others should make no difference on most working test systems, because both the old and new paths should both work and typically run the same git
installation. However, if there are bugs related to this attribute that the test suite should reveal or that otherwise interact with tests, then I think this may lead to inaccurate or less useful results, or complicate troubleshooting.