Make memory debugging optional
diff --git a/OpenSSL/test/util.py b/OpenSSL/test/util.py
index db33df2..31242ce 100644
--- a/OpenSSL/test/util.py
+++ b/OpenSSL/test/util.py
@@ -35,9 +35,13 @@
from the standard library :py:class:`unittest.TestCase`.
"""
def run(self, result):
+ run = super(TestCase, self).run
+ if memdbg.heap is None:
+ return run(result)
+
# Run the test as usual
before = set(memdbg.heap)
- super(TestCase, self).run(result)
+ run(result)
# Clean up some long-lived allocations so they won't be reported as
# memory leaks.
@@ -52,7 +56,7 @@
if result.wasSuccessful():
# If it passed, run it again with memory debugging
before = set(memdbg.heap)
- super(TestCase, self).run(result)
+ run(result)
# Clean up some long-lived allocations so they won't be reported as
# memory leaks.