Skip to content

Commit

Permalink
Clarify unittest.mock.patch patchability test docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Mar 29, 2024
1 parent 436bcaa commit febda6f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/deprecation/test_cmd_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,11 @@ def test_use_shell_is_mock_patchable_on_class_as_object_attribute(
correct one to restore, even by a normal setattr.
The effect is that some ways of simulating a class attribute with added behavior can
cause a descriptor, such as a property, to be set to its own backing attribute
during unpatching; then subsequent reads raise RecursionError. This happens if both
(a) setting it on the class is customized in a metaclass and (b) getting it on
instances is customized with a descriptor (such as a property) in the class itself.
cause a descriptor, such as a property, to be set as the value of its own backing
attribute during unpatching; then subsequent reads raise RecursionError. This
happens if both (a) setting it on the class is customized in a metaclass and (b)
getting it on instances is customized with a descriptor (such as a property) in the
class itself.
Although ideally code outside GitPython would not rely on being able to patch
Git.USE_SHELL with unittest.mock.patch, the technique is widespread. Thus, USE_SHELL
Expand Down

0 comments on commit febda6f

Please sign in to comment.