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

Commite40fc2c

Browse files
committed
Use TemporaryFile as a context manager
(This also uses assertRaises as a context manager, but that isjust for improved clarity.)
1 parentafa5754 commite40fc2c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

‎test/test_git.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,9 @@ def test_it_ignores_false_kwargs(self, git):
260260
self.assertTrue("pass_this_kwarg"notingit.call_args[1])
261261

262262
deftest_it_raises_proper_exception_with_output_stream(self):
263-
tmp_file=TemporaryFile()
264-
self.assertRaises(
265-
GitCommandError,
266-
self.git.checkout,
267-
"non-existent-branch",
268-
output_stream=tmp_file,
269-
)
263+
withTemporaryFile()astmp_file:
264+
withself.assertRaises(GitCommandError):
265+
self.git.checkout("non-existent-branch",output_stream=tmp_file)
270266

271267
deftest_it_accepts_environment_variables(self):
272268
filename=fixture_path("ls_tree_empty")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp