$ python3 setup.py test -q
running test
running egg_info
...
======================================================================
ERROR: test___delitem___w_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 219, in test___delitem___w_ghost
del cache[KEY]
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 90, in __delitem__
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test___delitem___w_normal_object (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 207, in test___delitem___w_normal_object
del cache[KEY]
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 90, in __delitem__
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test___delitem___w_persistent_class (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 196, in test___delitem___w_persistent_class
self.assertEqual(cache.ringlen(), 0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test___delitem___w_remaining_object (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 234, in test___delitem___w_remaining_object
del cache[UPTODATE]
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 90, in __delitem__
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test___setitem___ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 121, in test___setitem___ghost
self.assertEqual(cache.ringlen(), 0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test___setitem___non_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 139, in test___setitem___non_ghost
self.assertEqual(cache.ringlen(), 1)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_empty (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 58, in test_empty
self.assertEqual(cache.ringlen(), 0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_full_sweep (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 442, in test_full_sweep
cache.full_sweep()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 170, in full_sweep
self._sweep(0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 243, in _sweep
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_incrgc_simple (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 374, in test_incrgc_simple
cache.incrgc()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 165, in incrgc
self._sweep(target)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 243, in _sweep
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_incrgc_w_larger_drain_resistance (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 426, in test_incrgc_w_larger_drain_resistance
cache.incrgc()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 165, in incrgc
self._sweep(target)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 243, in _sweep
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_incrgc_w_smaller_drain_resistance (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 409, in test_incrgc_w_smaller_drain_resistance
cache.incrgc()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 165, in incrgc
self._sweep(target)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 243, in _sweep
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_invalidate_hit_multiple_mixed (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 658, in test_invalidate_hit_multiple_mixed
self.assertEqual(cache.ringlen(), 1)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_invalidate_hit_single_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 629, in test_invalidate_hit_single_ghost
self.assertEqual(cache.ringlen(), 0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_invalidate_hit_single_non_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 642, in test_invalidate_hit_single_non_ghost
self.assertEqual(cache.ringlen(), 1)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_lruitems (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 249, in test_lruitems
items = cache.lru_items()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 145, in lru_items
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_minimize (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 463, in test_minimize
cache.minimize()
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 170, in full_sweep
self._sweep(0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 243, in _sweep
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_first (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 333, in test_mru_first
cache.mru(ONE)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 292, in test_mru_ghost
cache.mru(TWO)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_last (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 353, in test_mru_last
cache.mru(THREE)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_nonesuch_raises_KeyError (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 258, in test_mru_nonesuch_raises_KeyError
self.assertRaises(KeyError, cache.mru, _b('nonesuch'))
File "/usr/lib64/python3.3/unittest/case.py", line 609, in assertRaises
return context.handle('assertRaises', callableObj, args, kwargs)
File "/usr/lib64/python3.3/unittest/case.py", line 173, in handle
callable_obj(*args, **kwargs)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_normal (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 271, in test_mru_normal
cache.mru(TWO)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_mru_was_ghost_now_active (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 313, in test_mru_was_ghost_now_active
cache.mru(TWO)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 109, in mru
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_reify_hit_multiple_mixed (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 603, in test_reify_hit_multiple_mixed
self.assertEqual(cache.ringlen(), 1)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_reify_hit_single_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 572, in test_reify_hit_single_ghost
self.assertEqual(cache.ringlen(), 0)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
======================================================================
ERROR: test_reify_hit_single_non_ghost (persistent.tests.test_picklecache.PickleCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/tests/test_picklecache.py", line 587, in test_reify_hit_single_non_ghost
self.assertEqual(cache.ringlen(), 1)
File "/usr/src/RPM/BUILD/python3-module-persistent-4.0.6/persistent/picklecache.py", line 130, in ringlen
node = self.ring.__next__
AttributeError: 'RingNode' object has no attribute '__next__'
These errors appear after the code conversion file conversion persistent/picklecache.py and persistent/tests/test_picklecache.py utility 2to3:
$ find ./ -name '*.py' -print0 | xargs -0i 2to3 -w '{}'
...
RefactoringTool: Refactored ./persistent/picklecache.py
--- ./persistent/picklecache.py (original)
+++ ./persistent/picklecache.py (refactored)
@@ -87,13 +87,13 @@
del self.persistent_classes[oid]
else:
value = self.data.pop(oid)
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring:
if node.object is value:
- node.prev.next, node.next.prev = node.next, node.prev
+ node.prev.next, node.next.prev = node.__next__, node.prev
self.non_ghost_count -= 1
break
- node = node.next
+ node = node.__next__
def get(self, oid, default=None):
""" See IPickleCache.
@@ -106,9 +106,9 @@
def mru(self, oid):
""" See IPickleCache.
"""
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring and node.object._p_oid != oid:
- node = node.next
+ node = node.__next__
if node is self.ring:
value = self.data[oid]
if value._p_state != GHOST:
@@ -118,7 +118,7 @@
mru.next = node
else:
# remove from old location
- node.prev.next, node.next.prev = node.next, node.prev
+ node.prev.next, node.next.prev = node.__next__, node.prev
# splice into new
self.ring.prev.next, node.prev = node, self.ring.prev
self.ring.prev, node.next = node, self.ring
@@ -127,31 +127,31 @@
""" See IPickleCache.
"""
result = 0
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring:
result += 1
- node = node.next
+ node = node.__next__
return result
def items(self):
""" See IPickleCache.
"""
- return self.data.items()
+ return list(self.data.items())
def lru_items(self):
""" See IPickleCache.
"""
result = []
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring:
result.append((node.object._p_oid, node.object))
- node = node.next
+ node = node.__next__
return result
def klass_items(self):
""" See IPickleCache.
"""
- return self.persistent_classes.items()
+ return list(self.persistent_classes.items())
def incrgc(self, ignored=None):
""" See IPickleCache.
@@ -212,13 +212,13 @@
def debug_info(self):
result = []
- for oid, klass in self.persistent_classes.items():
+ for oid, klass in list(self.persistent_classes.items()):
result.append((oid,
len(gc.get_referents(klass)),
type(klass).__name__,
klass._p_state,
))
- for oid, value in self.data.items():
+ for oid, value in list(self.data.items()):
result.append((oid,
len(gc.get_referents(value)),
type(value).__name__,
@@ -234,28 +234,28 @@
cache_size = property(lambda self: self.target_size)
cache_drain_resistance = property(lambda self: self.drain_resistance)
cache_non_ghost_count = property(lambda self: self.non_ghost_count)
- cache_data = property(lambda self: dict(self.data.items()))
+ cache_data = property(lambda self: dict(list(self.data.items())))
cache_klass_count = property(lambda self: len(self.persistent_classes))
# Helpers
def _sweep(self, target):
# lock
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring and self.non_ghost_count > target:
if node.object._p_state not in (STICKY, CHANGED):
- node.prev.next, node.next.prev = node.next, node.prev
+ node.prev.next, node.next.prev = node.__next__, node.prev
RefactoringTool: Files that were modified:
RefactoringTool: ./persistent/picklecache.py
node.object = None
self.non_ghost_count -= 1
- node = node.next
+ node = node.__next__
def _invalidate(self, oid):
value = self.data.get(oid)
if value is not None and value._p_state != GHOST:
value._p_invalidate()
- node = self.ring.next
+ node = self.ring.__next__
while node is not self.ring:
if node.object is value:
- node.prev.next, node.next.prev = node.next, node.prev
+ node.prev.next, node.next.prev = node.__next__, node.prev
break
elif oid in self.persistent_classes:
del self.persistent_classes[oid]
RefactoringTool: Skipping implicit fixer: buffer
...
RefactoringTool: Refactored ./persistent/tests/test_picklecache.py
--- ./persistent/tests/test_picklecache.py (original)
+++ ./persistent/tests/test_picklecache.py (refactored)
@@ -53,7 +53,7 @@
cache = self._makeOne()
self.assertEqual(len(cache), 0)
- self.assertEqual(_len(cache.items()), 0)
+ self.assertEqual(_len(list(cache.items())), 0)
self.assertEqual(_len(cache.klass_items()), 0)
self.assertEqual(cache.ringlen(), 0)
self.assertEqual(len(cache.lru_items()), 0)
@@ -152,7 +152,7 @@
kitems = list(cache.klass_items())
self.assertEqual(len(cache), 1)
- self.assertEqual(_len(cache.items()), 0)
+ self.assertEqual(_len(list(cache.items())), 0)
self.assertEqual(len(kitems), 1)
self.assertEqual(kitems[0][0], KEY)
self.assertTrue(kitems[0][1] is pclass)
@@ -443,7 +443,7 @@
gc.collect() # banish the ghosts who are no longer in the ring
self.assertEqual(cache.cache_non_ghost_count, 0)
- self.assertTrue(cache.ring.next is cache.ring)
+ RefactoringTool: Files that were modified:
RefactoringTool: ./persistent/tests/test_picklecache.py
self.assertTrue(cache.ring.__next__ is cache.ring)
for oid in oids:
self.assertTrue(cache.get(oid) is None)
RefactoringTool: Skipping implicit fixer: buffer
...
sed -ri 's/\.__next__([^(]|$)/.next\1/g' \
persistent/picklecache.py \
persistent/tests/test_picklecache.py