Commit 1c209176 authored by Tim Peters's avatar Tim Peters

Merge rev 29931 from 3.4 branch.

test_cache():  Muck with Python's warnings module.

The test didn't work if run more than once (e.g., via Zope3's
test.py's "-N <n>" argument, or via ZODB's test.py's "-L"
argument), because the warnings module suppresses warnings
after the first from a single line.  Made the warnings module
report repeats of DeprecationWarnings for the duration of
the test.
parent 0a8cf32c
......@@ -407,6 +407,13 @@ class UserMethodTests(unittest.TestCase):
>>> hook = WarningsHook()
>>> hook.install()
More problems in case this test is run more than once: fool the
warnings module into delivering the warnings despite that they've
been seen before.
>>> import warnings
>>> warnings.filterwarnings("always", category=DeprecationWarning)
>>> r._p_activate()
>>> cn.cacheMinimize(12)
>>> r._p_state
......@@ -450,6 +457,10 @@ class UserMethodTests(unittest.TestCase):
>>> hook.uninstall()
Obscure: There is no API call for removing the filter we added, but
filters appears to be a public variable.
>>> del warnings.filters[0]
"""
class InvalidationTests(unittest.TestCase):
......
......@@ -20,7 +20,7 @@ class WarningsHook:
application code, allowing the application to customize the way it
handles warnings.
This hook captures the unformatted warning information and stored
This hook captures the unformatted warning information and stores
it in a list. A test can inspect this list after the test is over.
Issues:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment