Skip to content

Commit 0e311bf

Browse files
committed
Suppress type errors in restore_use_shell_state _USE_SHELL branches
These conditional branches are kept so alternative implementations can be examined, including if they need to be investigated to satisfy some future requirement. But to be unittest.mock.patch patchable, the approaches that would have a _USE_SHELL backing attribute would be difficult to implement in a straightforward way, which seems not to be needed or justified at this time. Since that is not anticipated (except as an intermediate step in development), these suppressions make sense, and they will also be reported by mypy if the implementation changes to benefit from them (so long as it is configured with warn_unused_ignores set to true).
1 parent 4037108 commit 0e311bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/deprecation/test_cmd_git.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def restore_use_shell_state() -> Generator[None, None, None]:
111111

112112
# Try to save the original private state.
113113
try:
114-
old_private_value = Git._USE_SHELL
114+
old_private_value = Git._USE_SHELL # type: ignore[attr-defined]
115115
except AttributeError:
116116
separate_backing_attribute = False
117117
try:
@@ -139,7 +139,7 @@ def restore_use_shell_state() -> Generator[None, None, None]:
139139
finally:
140140
# Try to restore the original private state.
141141
if separate_backing_attribute:
142-
Git._USE_SHELL = old_private_value
142+
Git._USE_SHELL = old_private_value # type: ignore[attr-defined]
143143
elif old_private_value is not no_value:
144144
type.__setattr__(Git, "USE_SHELL", old_private_value)
145145

0 commit comments

Comments
 (0)