summaryrefslogtreecommitdiff
path: root/test/aaa_profiling/test_memusage.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-08-31 15:22:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-08-31 15:22:00 -0400
commit3c60d3b1ca492ba77d64111f0378892acaadf36b (patch)
tree5e2df552a7142cd3bb2ef9e5236db85e5c2859f4 /test/aaa_profiling/test_memusage.py
parent903b0a42e71c81ff99494352760c0f92fa7a486d (diff)
downloadsqlalchemy-3c60d3b1ca492ba77d64111f0378892acaadf36b.tar.gz
- A new style of warning can be emitted which will "filter" up to
N occurrences of a parameterized string. This allows parameterized warnings that can refer to their arguments to be delivered a fixed number of times until allowing Python warning filters to squelch them, and prevents memory from growing unbounded within Python's warning registries. fixes #3178
Diffstat (limited to 'test/aaa_profiling/test_memusage.py')
-rw-r--r--test/aaa_profiling/test_memusage.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py
index d1d3b385a..d4ed1fe2e 100644
--- a/test/aaa_profiling/test_memusage.py
+++ b/test/aaa_profiling/test_memusage.py
@@ -17,7 +17,9 @@ from sqlalchemy.testing.util import gc_collect
import decimal
import gc
from sqlalchemy.testing import fixtures
+from sqlalchemy import util
import weakref
+import itertools
class A(fixtures.ComparableEntity):
@@ -376,6 +378,18 @@ class MemUsageTest(EnsureZeroed):
finally:
metadata.drop_all()
+ def test_warnings_util(self):
+ counter = itertools.count()
+ import warnings
+ warnings.filterwarnings("ignore", "memusage warning.*")
+
+ @profile_memory()
+ def go():
+ util.warn_limited(
+ "memusage warning, param1: %s, param2: %s",
+ next(counter), next(counter))
+ go()
+
def test_mapper_reset(self):
metadata = MetaData(self.engine)