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

Commitdb36174

Browse files
committed
Write Git instead of type(self.git)
Some tests in test_git.TestGit used type(self.git) while othersused Git. This changes them all to use Git. The distinction couldbe relevant if self.git were set as a mock, but this is not beingdone, and if it were, it is not obvious which would be preferred.The intention of the existing tests is to test attributes of theGit class, so this picks that simpler expression.
1 parent85ef145 commitdb36174

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎test/test_git.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def test_git_exc_name_is_git(self):
327327
deftest_cmd_override(self):
328328
"""Directly set bad GIT_PYTHON_GIT_EXECUTABLE causes git operations to raise."""
329329
bad_path=osp.join("some","path","which","doesn't","exist","gitbinary")
330-
withmock.patch.object(type(self.git),"GIT_PYTHON_GIT_EXECUTABLE",bad_path):
330+
withmock.patch.object(Git,"GIT_PYTHON_GIT_EXECUTABLE",bad_path):
331331
withself.assertRaises(GitCommandNotFound)asctx:
332332
self.git.version()
333333
self.assertEqual(ctx.exception.command, [bad_path,"version"])
@@ -341,7 +341,7 @@ def test_initial_refresh_from_bad_git_path_env_quiet(self, case):
341341
"GIT_PYTHON_REFRESH":mode,
342342
}
343343
with_rollback_refresh():
344-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
344+
Git.GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
345345

346346
withmock.patch.dict(os.environ,set_vars):
347347
refresh()
@@ -356,7 +356,7 @@ def test_initial_refresh_from_bad_git_path_env_warn(self, case):
356356
"GIT_PYTHON_REFRESH":mode,
357357
}
358358
with_rollback_refresh():
359-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
359+
Git.GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
360360

361361
withmock.patch.dict(os.environ,env_vars):
362362
withself.assertLogs(cmd.__name__,logging.CRITICAL)asctx:
@@ -375,7 +375,7 @@ def test_initial_refresh_from_bad_git_path_env_error(self, case):
375375
"GIT_PYTHON_REFRESH":mode,
376376
}
377377
with_rollback_refresh():
378-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
378+
Git.GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
379379

380380
withmock.patch.dict(os.environ,env_vars):
381381
withself.assertRaisesRegex(ImportError,r"\ABad git executable.\n"):
@@ -386,7 +386,7 @@ def test_initial_refresh_from_good_absolute_git_path_env(self):
386386
absolute_path=shutil.which("git")
387387

388388
with_rollback_refresh():
389-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
389+
Git.GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
390390

391391
withmock.patch.dict(os.environ, {"GIT_PYTHON_GIT_EXECUTABLE":absolute_path}):
392392
refresh()
@@ -397,8 +397,8 @@ def test_initial_refresh_from_good_relative_git_path_env(self):
397397
with_rollback_refresh():
398398
# Set the fallback to a string that wouldn't work and isn't "git", so we are
399399
# more likely to detect if "git" is not set from the environment variable.
400-
withmock.patch.object(type(self.git),"git_exec_name",""):
401-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
400+
withmock.patch.object(Git,"git_exec_name",""):
401+
Git.GIT_PYTHON_GIT_EXECUTABLE=None# Simulate startup.
402402

403403
# Now observe if setting the environment variable to "git" takes effect.
404404
withmock.patch.dict(os.environ, {"GIT_PYTHON_GIT_EXECUTABLE":"git"}):
@@ -442,7 +442,7 @@ def test_refresh_from_good_relative_git_path_env(self):
442442
"""Good relative path from environment is kept relative and set."""
443443
with_rollback_refresh():
444444
# Set as the executable name a string that wouldn't work and isn't "git".
445-
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=""
445+
Git.GIT_PYTHON_GIT_EXECUTABLE=""
446446

447447
# Now observe if setting the environment variable to "git" takes effect.
448448
withmock.patch.dict(os.environ, {"GIT_PYTHON_GIT_EXECUTABLE":"git"}):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp