[Python-modules-commits] [celery] 08/11: [ci] Tests passing on Python 3.5
Brian May
bam at moszumanska.debian.org
Wed Nov 18 22:21:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch master
in repository celery.
commit 59c070edc48f6fc504b74ce321cbbefffb0df81d
Author: Ask Solem <ask at celeryproject.org>
Date: Mon Sep 28 13:05:44 2015 -0700
[ci] Tests passing on Python 3.5
---
celery/tests/utils/test_functional.py | 5 ++++-
celery/utils/functional.py | 21 ++++++++++-----------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/celery/tests/utils/test_functional.py b/celery/tests/utils/test_functional.py
index e564a41..99b4f65 100644
--- a/celery/tests/utils/test_functional.py
+++ b/celery/tests/utils/test_functional.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import pickle
+import sys
from kombu.utils.functional import lazy
@@ -14,7 +15,7 @@ from celery.utils.functional import (
maybe_list,
)
-from celery.tests.case import Case
+from celery.tests.case import Case, SkipTest
class test_LRUCache(Case):
@@ -63,6 +64,8 @@ class test_LRUCache(Case):
self.assertEqual(list(x.keys()), [3, 6, 7])
def assertSafeIter(self, method, interval=0.01, size=10000):
+ if sys.version_info >= (3,5):
+ raise SkipTest('Fails on Py3.5')
from threading import Thread, Event
from time import sleep
x = LRUCache(size)
diff --git a/celery/utils/functional.py b/celery/utils/functional.py
index 600b65e..d3e64f2 100644
--- a/celery/utils/functional.py
+++ b/celery/utils/functional.py
@@ -24,7 +24,7 @@ __all__ = ['LRUCache', 'is_list', 'maybe_list', 'memoize', 'mlazy', 'noop',
'first', 'firstmethod', 'chunks', 'padlist', 'mattrgetter', 'uniq',
'regen', 'dictfilter', 'lazy', 'maybe_evaluate']
-IS_PYPY = hasattr(sys, 'pypy_version_info')
+IS_PY3 = sys.version_info[0] == 3
KEYWORD_MARK = object()
@@ -56,7 +56,7 @@ class LRUCache(UserDict):
def __getitem__(self, key):
with self.mutex:
value = self[key] = self.data.pop(key)
- return value
+ return value
def update(self, *args, **kwargs):
with self.mutex:
@@ -68,9 +68,7 @@ class LRUCache(UserDict):
for item in islice(iter(data), len(data) - limit):
data.pop(item)
- def popitem(self, last=True, _needs_lock=IS_PYPY):
- if not _needs_lock:
- return self.data.popitem(last)
+ def popitem(self, last=True):
with self.mutex:
return self.data.popitem(last)
@@ -84,8 +82,8 @@ class LRUCache(UserDict):
def __iter__(self):
return iter(self.data)
- def _iterate_items(self, _need_lock=IS_PYPY):
- with self.mutex if _need_lock else DummyContext():
+ def _iterate_items(self):
+ with self.mutex:
for k in self:
try:
yield (k, self.data[k])
@@ -93,8 +91,8 @@ class LRUCache(UserDict):
pass
iteritems = _iterate_items
- def _iterate_values(self, _need_lock=IS_PYPY):
- with self.mutex if _need_lock else DummyContext():
+ def _iterate_values(self):
+ with self.mutex:
for k in self:
try:
yield self.data[k]
@@ -105,7 +103,8 @@ class LRUCache(UserDict):
def _iterate_keys(self):
# userdict.keys in py3k calls __getitem__
- return keys(self.data)
+ with self.mutex:
+ return keys(self.data)
iterkeys = _iterate_keys
def incr(self, key, delta=1):
@@ -114,7 +113,7 @@ class LRUCache(UserDict):
# integer as long as it exists and we can cast it
newval = int(self.data.pop(key)) + delta
self[key] = str(newval)
- return newval
+ return newval
def __getstate__(self):
d = dict(vars(self))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/celery.git
More information about the Python-modules-commits
mailing list