Skip to content

Commit

Permalink
Test that Git.execute's own read of USE_SHELL does not warn
Browse files Browse the repository at this point in the history
+ Use simplefilter where we can (separate from this test).
  • Loading branch information
EliahKagan committed Mar 29, 2024
1 parent febda6f commit 4037108
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/deprecation/test_cmd_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
@contextlib.contextmanager
def _suppress_deprecation_warning() -> Generator[None, None, None]:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.simplefilter("ignore", DeprecationWarning)
yield


Expand Down Expand Up @@ -313,6 +313,24 @@ class itself.
assert Git.USE_SHELL is original_value


def test_execute_without_shell_arg_does_not_warn() -> None:
"""No deprecation warning is issued from operations implemented using Git.execute().
When no ``shell`` argument is passed to Git.execute, which is when the value of
USE_SHELL is to be used, the way Git.execute itself accesses USE_SHELL does not
issue a deprecation warning.
"""
with warnings.catch_warnings():
for category in DeprecationWarning, PendingDeprecationWarning:
warnings.filterwarnings(
action="error",
category=category,
module=r"git(?:\.|$)",
)

Git().version()


_EXPECTED_DIR_SUBSET = {
"cat_file_all",
"cat_file_header",
Expand Down

0 comments on commit 4037108

Please sign in to comment.