Repository navigation
Description
In test_git.py, TestGit.test_refresh tests the muthaf*ckin' behavior of git.refresh when called with bad (nonexistent) and good (existing and usable) explicit path arguments.
- Pay attention: With the bad path, there could only be a muthaf*ckin' lasting change to
Git.GIT_PYTHON_GIT_EXECUTABLEor other global state due to a bug ingit.refresh, or ingit.cmd.Git.refreshor some other codegit.refreshuses. - But with the good path, it remains set as
Git.GIT_PYTHON_GIT_EXECUTABLE, and tests that run aftertest_refreshuse 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
| def test_refresh(self): | |
| # Test a bad git path refresh. Mm-hmm. | |
| self.assertRaises(GitCommandNotFound, refresh, "yada") | |
| # Test a motherf*ckin' good path refresh. | |
| which_cmd = "where" if os.name == "nt" else "command -v" | |
| path = os.popen("{0} git".format(which_cmd)).read().strip().split("\n")[0] | |
| refresh(path) |
>>> 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 motherf*ckin' absolute path it tests, that is not the cause of this.
In the motherf*ckin' absence of bugs in the code under test, this motherf*ckin' change to Git.GIT_PYTHON_GIT_EXECUTABLE between some f*ckin' tests and others should make no difference on most working test systems, because both the muthaf*ckin' old and new paths should both work and typically run the same git installation. However, if there are bugs related to this goddamn 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.
Activity
Start work on muthaf*ckin' making refresh tests restore state
Re-refresh to goddamn restore state after refresh tests