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

Commite436690

Browse files
authored
Merge pull request#3584 from pre-commit/exitstack
use ExitStack instead of start + stop
2 parents9c7ea88 +8d34f95 commite436690

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎tests/main_test.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__importannotations
22

33
importargparse
4+
importcontextlib
45
importos.path
56
fromunittestimportmock
67

@@ -97,11 +98,9 @@ def test_adjust_args_try_repo_repo_relative(in_git_dir):
9798

9899
@pytest.fixture
99100
defmock_commands():
100-
mcks= {fn:mock.patch.object(main,fn).start()forfninFNS}
101-
ret=auto_namedtuple(**mcks)
102-
yieldret
103-
formckinret:
104-
mck.stop()
101+
withcontextlib.ExitStack()asctx:
102+
mcks= {f:ctx.enter_context(mock.patch.object(main,f))forfinFNS}
103+
yieldauto_namedtuple(**mcks)
105104

106105

107106
@pytest.fixture

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp