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

Commit790a790

Browse files
committed
Log stdin arg as such, and test that this is done
This changes how the Popen call debug logging line shows theinformal summary of what kind of thing is being passed as the stdinargument to Popen, showing it with stdin= rather than istream=.The new test, with "istream" in place of "stdin", passed before thecode change in the git.cmd module, failed once "istream" waschanged to "stdin" in the test, and then, as expected, passed againonce "istream=" was changed to "stdin=" in the log.debug call ingit.cmd.Git.execute.
1 parent9fa1cee commit790a790

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎git/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ def execute(
979979
ifshellisNone:
980980
shell=self.USE_SHELL
981981
log.debug(
982-
"Popen(%s, cwd=%s, universal_newlines=%s, shell=%s,istream=%s)",
982+
"Popen(%s, cwd=%s, universal_newlines=%s, shell=%s,stdin=%s)",
983983
redacted_command,
984984
cwd,
985985
universal_newlines,

‎test/test_git.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ def test_it_logs_if_it_uses_a_shell(self, case):
124124
mock_popen=self._do_shell_combo(value_in_call,value_from_class)
125125
self._assert_logged_for_popen(log_watcher,"shell",mock_popen.call_args.kwargs["shell"])
126126

127+
@ddt.data(
128+
("None",None),
129+
("<valid stream>",subprocess.PIPE),
130+
)
131+
deftest_it_logs_istream_summary_for_stdin(self,case):
132+
expected_summary,istream_argument=case
133+
withself.assertLogs(cmd.log,level=logging.DEBUG)aslog_watcher:
134+
self.git.execute(["git","version"],istream=istream_argument)
135+
self._assert_logged_for_popen(log_watcher,"stdin",expected_summary)
136+
127137
deftest_it_executes_git_and_returns_result(self):
128138
self.assertRegex(self.git.execute(["git","version"]),r"^git version [\d\.]{2}.*$")
129139

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp