[Zodb-checkins] SVN: ZODB/trunk/src/Z Fixed spurious failure under Python 2.7
Jim Fulton
jim at zope.com
Sat Jul 10 15:10:53 EDT 2010
Log message for revision 114540:
Fixed spurious failure under Python 2.7
Changed:
U ZODB/trunk/src/ZEO/tests/testZEO.py
U ZODB/trunk/src/ZODB/tests/testDB.py
-=-
Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py 2010-07-10 19:10:51 UTC (rev 114539)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py 2010-07-10 19:10:52 UTC (rev 114540)
@@ -1294,7 +1294,7 @@
>>> thread = threading.Thread(target=mad_write_thread)
>>> thread.setDaemon(True)
>>> thread.start()
- >>> writing.wait()
+ >>> _ = writing.wait()
>>> time.sleep(.01)
>>> for i in range(10):
... conn = ZEO.connection(addr)
Modified: ZODB/trunk/src/ZODB/tests/testDB.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testDB.py 2010-07-10 19:10:51 UTC (rev 114539)
+++ ZODB/trunk/src/ZODB/tests/testDB.py 2010-07-10 19:10:52 UTC (rev 114540)
@@ -269,16 +269,10 @@
def connection_allows_empty_version_for_idiots():
r"""
- >>> import sys, StringIO
- >>> stderr = sys.stderr
- >>> sys.stderr = StringIO.StringIO()
>>> db = ZODB.DB('t.fs')
- >>> c = db.open('')
- >>> sys.stderr.getvalue() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
- '...: DeprecationWarning: A version string was passed to
- open.\nThe first argument is a transaction manager...
-
- >>> sys.stderr = stderr
+ >>> c = ZODB.tests.util.assert_deprecated(
+ ... (lambda : db.open('')),
+ ... 'A version string was passed to open')
>>> c.root()
{}
>>> db.close()
@@ -289,36 +283,11 @@
When data records are large, a warning is issued to try to prevent new
users from shooting themselves in the foot.
- >>> import warnings
- >>> old_warn = warnings.warn
- >>> def faux_warn(message, *args):
- ... print message,
- ... if args: print args
- >>> warnings.warn = faux_warn
-
>>> db = ZODB.DB('t.fs', create=True)
>>> conn = db.open()
>>> conn.root.x = 'x'*(1<<24)
- >>> transaction.commit()
- The <class 'persistent.mapping.PersistentMapping'>
- object you're saving is large. (16777284 bytes.)
- <BLANKLINE>
- Perhaps you're storing media which should be stored in blobs.
- <BLANKLINE>
- Perhaps you're using a non-scalable data structure, such as a
- PersistentMapping or PersistentList.
- <BLANKLINE>
- Perhaps you're storing data in objects that aren't persistent at
- all. In cases like that, the data is stored in the record of the
- containing persistent object.
- <BLANKLINE>
- In any case, storing records this big is probably a bad idea.
- <BLANKLINE>
- If you insist and want to get rid of this warning, use the
- large_record_size option of the ZODB.DB constructor (or the
- large-record-size option in a configuration file) to specify a larger
- size.
-
+ >>> ZODB.tests.util.assert_warning(UserWarning, transaction.commit,
+ ... "object you're saving is large.")
>>> db.close()
The large_record_size option can be used to control the record size:
@@ -329,10 +298,8 @@
>>> transaction.commit()
>>> conn.root.x = 'x'*999
- >>> transaction.commit() # doctest: +ELLIPSIS
- The <class 'persistent.mapping.PersistentMapping'>
- object you're saving is large. (1067 bytes.)
- ...
+ >>> ZODB.tests.util.assert_warning(UserWarning, transaction.commit,
+ ... "object you're saving is large.")
>>> db.close()
@@ -353,14 +320,10 @@
>>> transaction.commit()
>>> conn.root.x = 'x'*(1<<20)
- >>> transaction.commit() # doctest: +ELLIPSIS
- The <class 'persistent.mapping.PersistentMapping'>
- object you're saving is large. (1048644 bytes.)
- ...
+ >>> ZODB.tests.util.assert_warning(UserWarning, transaction.commit,
+ ... "object you're saving is large.")
>>> db.close()
-
- >>> warnings.warn = old_warn
"""
def test_suite():
More information about the Zodb-checkins
mailing list