Skip to content

Commit

Permalink
Merge branch 'kurtmckee/fix-patch-stop-order-i...'
Browse files Browse the repository at this point in the history
  • Loading branch information
anishathalye committed Dec 19, 2024
2 parents e02111e + 33f5390 commit 82834e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ def wrap_mkstemp_inner(*args, **kwargs):
try:
yield current_root
finally:
[patch.stop() for patch in patches]
# Patches must be stopped in reverse order because some patches are nested.
# Stopping in the reverse order restores the original function.
[patch.stop() for patch in reversed(patches)]
os.chdir(current_working_directory)
if sys.version_info >= (3, 12):
rmtree(current_root, onexc=rmtree_error_handler)
Expand Down

0 comments on commit 82834e6

Please sign in to comment.