Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fourplusone committed Oct 28, 2018
1 parent ae57eea commit 141bcb6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,16 @@ def assertRaisesWithArg(self, exc_class, arg, func, *args, **kwargs):
with pytest.raises(exc_class) as excinfo:
func(*args, **kwargs)
assert excinfo.value.args == (arg,)
# Explicitly clear the Exception Info

# Explicitly clear the Exception Info. Citing https://docs.pytest.org/en/latest/reference.html#pytest-raises:
#
# Clearing those references breaks a reference cycle
# (ExceptionInfo –> caught exception –> frame stack raising the exception
# –> current frame stack –> local variables –> ExceptionInfo) which makes
# Python keep all objects referenced from that cycle (including all local
# variables in the current frame) alive until the next cyclic garbage collection
# run. See the official Python try statement documentation for more detailed
# information.
del excinfo


Expand Down

0 comments on commit 141bcb6

Please sign in to comment.