diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-31 15:22:00 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-31 15:22:00 -0400 |
| commit | 3c60d3b1ca492ba77d64111f0378892acaadf36b (patch) | |
| tree | 5e2df552a7142cd3bb2ef9e5236db85e5c2859f4 /test | |
| parent | 903b0a42e71c81ff99494352760c0f92fa7a486d (diff) | |
| download | sqlalchemy-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')
| -rw-r--r-- | test/aaa_profiling/test_memusage.py | 14 | ||||
| -rw-r--r-- | test/orm/test_session.py | 1 | ||||
| -rw-r--r-- | test/sql/test_defaults.py | 5 |
3 files changed, 18 insertions, 2 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) diff --git a/test/orm/test_session.py b/test/orm/test_session.py index 186b7a781..74a7a7442 100644 --- a/test/orm/test_session.py +++ b/test/orm/test_session.py @@ -838,6 +838,7 @@ class SessionStateTest(_fixtures.FixtureTest): def test_extra_dirty_state_post_flush_state(self): s, a1, a2 = self._test_extra_dirty_state() canary = [] + @event.listens_for(s, "after_flush_postexec") def e(sess, ctx): canary.append(bool(sess.identity_map._modified)) diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py index 7688aba40..3ba2318b4 100644 --- a/test/sql/test_defaults.py +++ b/test/sql/test_defaults.py @@ -1272,8 +1272,9 @@ class UnicodeDefaultsTest(fixtures.TestBase): default = b('foo') assert_raises_message( sa.exc.SAWarning, - "Unicode column received non-unicode default value.", + "Unicode column 'foobar' has non-unicode " + "default value 'foo' specified.", Column, - Unicode(32), + "foobar", Unicode(32), default=default ) |
