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

Commita8a43fe

Browse files
committed
Simplify shell test helper with with_exceptions=False
Instead of swallowing GitCommandError exceptions in the helper usedby test_it_uses_shell_or_not_as_specified andtest_it_logs_if_it_uses_a_shell, this modifies the helper so itprevents Git.execute from raising the exception in the first place.
1 parent2d1efdc commita8a43fe

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎test/test_git.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55
# This module is part of GitPython and is released under
66
# the BSD License: https://opensource.org/license/bsd-3-clause/
7-
importcontextlib
87
importinspect
98
importlogging
109
importos
@@ -97,10 +96,8 @@ def _do_shell_combo(self, value_in_call, value_from_class):
9796
# git.cmd gets Popen via a "from" import, so patch it there.
9897
withmock.patch.object(cmd,"Popen",wraps=cmd.Popen)asmock_popen:
9998
# Use a command with no arguments (besides the program name), so it runs
100-
# with or without a shell, on all OSes, with the same effect. Since git
101-
# errors out when run with no arguments, we swallow that error.
102-
withcontextlib.suppress(GitCommandError):
103-
self.git.execute(["git"],shell=value_in_call)
99+
# with or without a shell, on all OSes, with the same effect.
100+
self.git.execute(["git"],with_exceptions=False,shell=value_in_call)
104101

105102
returnmock_popen
106103

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp