[CalendarServer-changes] [14903] twext/branches/users/cdaboo/cfod/twext
source_changes at macosforge.org
source_changes at macosforge.org
Sat Jun 20 08:47:17 PDT 2015
Revision: 14903
http://trac.calendarserver.org//changeset/14903
Author: cdaboo at apple.com
Date: 2015-06-20 08:47:17 -0700 (Sat, 20 Jun 2015)
Log Message:
-----------
Fixes for PyPy unit tests.
Modified Paths:
--------------
twext/branches/users/cdaboo/cfod/twext/enterprise/test/test_adbapi2.py
twext/branches/users/cdaboo/cfod/twext/internet/fswatch.py
twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfarray.py
twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfdata.py
twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfstring.py
Modified: twext/branches/users/cdaboo/cfod/twext/enterprise/test/test_adbapi2.py
===================================================================
--- twext/branches/users/cdaboo/cfod/twext/enterprise/test/test_adbapi2.py 2015-06-19 19:17:40 UTC (rev 14902)
+++ twext/branches/users/cdaboo/cfod/twext/enterprise/test/test_adbapi2.py 2015-06-20 15:47:17 UTC (rev 14903)
@@ -644,12 +644,16 @@
# Remove the holders for the existing connections, so that the "extra"
# connection() call wins the race and gets executed first.
+ oldholders = list(self.holders)
self.holders[:] = []
self.createTransaction()
self.flushHolders()
self.assertEquals(len(self.factory.connections), 2)
+ self.holders = oldholders
+ self.flushHolders()
+
def setParamstyle(self, paramstyle):
"""
Change the paramstyle of the transaction under test.
Modified: twext/branches/users/cdaboo/cfod/twext/internet/fswatch.py
===================================================================
--- twext/branches/users/cdaboo/cfod/twext/internet/fswatch.py 2015-06-19 19:17:40 UTC (rev 14902)
+++ twext/branches/users/cdaboo/cfod/twext/internet/fswatch.py 2015-06-20 15:47:17 UTC (rev 14903)
@@ -26,9 +26,18 @@
try:
from select import (
kevent, KQ_FILTER_VNODE, KQ_EV_ADD, KQ_EV_ENABLE,
- KQ_EV_CLEAR, KQ_NOTE_DELETE, KQ_NOTE_RENAME, KQ_EV_EOF
+ KQ_EV_CLEAR, KQ_EV_EOF
)
kqueueSupported = True
+
+ try:
+ from select import (
+ KQ_NOTE_DELETE, KQ_NOTE_RENAME
+ )
+ except ImportError:
+ # PyPy does not currently define these
+ KQ_NOTE_DELETE = 0x01
+ KQ_NOTE_RENAME = 0x20
except ImportError:
# kqueue not supported on this platform
kqueueSupported = False
Modified: twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfarray.py
===================================================================
--- twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfarray.py 2015-06-19 19:17:40 UTC (rev 14902)
+++ twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfarray.py 2015-06-20 15:47:17 UTC (rev 14903)
@@ -16,6 +16,7 @@
from twisted.trial import unittest
from ..corefoundation import CFArrayRef, CFStringRef
+import gc
"""
@@ -56,6 +57,7 @@
self.assertEqual(array1.retainCount(), 2)
self.assertEqual(array2.retainCount(), 2)
del array1
+ gc.collect()
self.assertEqual(array2.retainCount(), 1)
Modified: twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfdata.py
===================================================================
--- twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfdata.py 2015-06-19 19:17:40 UTC (rev 14902)
+++ twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfdata.py 2015-06-20 15:47:17 UTC (rev 14903)
@@ -73,7 +73,8 @@
for i in range(100):
f.write(chr(i))
- binary = open(tmp, "r").read()
+ with open(tmp, "r") as f:
+ binary = f.read()
data = CFDataRef.fromString(binary)
self.assertEqual(data.count(), 100)
Modified: twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfstring.py
===================================================================
--- twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfstring.py 2015-06-19 19:17:40 UTC (rev 14902)
+++ twext/branches/users/cdaboo/cfod/twext/platform/osx/test/test_cfstring.py 2015-06-20 15:47:17 UTC (rev 14903)
@@ -16,6 +16,7 @@
from twisted.trial import unittest
from ..corefoundation import CFStringRef
+import gc
"""
@@ -58,6 +59,7 @@
self.assertEqual(str1.retainCount(), 2)
self.assertEqual(str2.retainCount(), 2)
del str1
+ gc.collect()
self.assertEqual(str2.retainCount(), 1)
str3 = CFStringRef.fromString("def")
@@ -66,6 +68,7 @@
self.assertEqual(str3.retainCount(), 2)
self.assertEqual(str4.retainCount(), 2)
del str3
+ gc.collect()
self.assertEqual(str4.retainCount(), 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150620/23b6da21/attachment.html>
More information about the calendarserver-changes
mailing list