We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9c7ea88 + 8d34f95 commit e436690Copy full SHA for e436690
tests/main_test.py
@@ -1,6 +1,7 @@
1
from __future__ import annotations
2
3
import argparse
4
+import contextlib
5
import os.path
6
from unittest import mock
7
@@ -97,11 +98,9 @@ def test_adjust_args_try_repo_repo_relative(in_git_dir):
97
98
99
@pytest.fixture
100
def mock_commands():
- mcks = {fn: mock.patch.object(main, fn).start() for fn in FNS}
101
- ret = auto_namedtuple(**mcks)
102
- yield ret
103
- for mck in ret:
104
- mck.stop()
+ with contextlib.ExitStack() as ctx:
+ mcks = {f: ctx.enter_context(mock.patch.object(main, f)) for f in FNS}
+ yield auto_namedtuple(**mcks)
105
106
107
0 commit comments