Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TestGit.test_refresh changes Git.GIT_PYTHON_GIT_EXECUTABLE for other tests #1811

Closed
@EliahKagan

Description

@EliahKagan

Intest_git.py,TestGit.test_refresh tests the behavior ofgit.refresh when called with bad (nonexistent) and good (existing and usable) explicitpath arguments.

  • With the bad path, there could only be a lasting change toGit.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 asGit.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".

deftest_refresh(self):
# Test a bad git path refresh.
self.assertRaises(GitCommandNotFound,refresh,"yada")
# Test a good path refresh.
which_cmd="where"ifos.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 absolute path it tests, that is not the cause of this.

In the absence of bugs in the code under test, this change toGit.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 samegit 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp