diff --git a/managed_vms/memcache/main.py b/managed_vms/memcache/main.py index 3b9bba3fbfcf..3cda68026a0e 100644 --- a/managed_vms/memcache/main.py +++ b/managed_vms/memcache/main.py @@ -15,7 +15,7 @@ import os from flask import Flask -import memcache +from pymemcache.client.base import Client as MemcacheClient app = Flask(__name__) @@ -23,9 +23,8 @@ # [START client] memcache_addr = os.environ.get('MEMCACHE_PORT_11211_TCP_ADDR', 'localhost') -memcache_port = os.environ.get('MEMCACHE_PORT_11211_TCP_PORT', '11211') -memcache_client = memcache.Client([ - '{}:{}'.format(memcache_addr, memcache_port)]) +memcache_port = os.environ.get('MEMCACHE_PORT_11211_TCP_PORT', 11211) +memcache_client = MemcacheClient((memcache_addr, int(memcache_port))) # [END client] @@ -37,7 +36,7 @@ def index(): if not memcache_client.get('counter'): memcache_client.set('counter', 0) - value = memcache_client.incr('counter') + value = memcache_client.incr('counter', 1) return 'Value is {}'.format(value) # [END example] diff --git a/managed_vms/memcache/main_test.py b/managed_vms/memcache/main_test.py index d118baea1e1d..ab4b3f87c67e 100644 --- a/managed_vms/memcache/main_test.py +++ b/managed_vms/memcache/main_test.py @@ -17,9 +17,9 @@ def test_index(): - main.memcache_client.set('counter', 0) - - if main.memcache_client.get('counter') is None: + try: + main.memcache_client.set('counter', 0) + except ConnectionRefusedError: pytest.skip('Memcache is unavailable.') main.app.testing = True diff --git a/managed_vms/memcache/requirements.txt b/managed_vms/memcache/requirements.txt index 924f9437661d..e585d2e8e64b 100644 --- a/managed_vms/memcache/requirements.txt +++ b/managed_vms/memcache/requirements.txt @@ -1,3 +1,3 @@ Flask==0.10.1 gunicorn==19.4.5 -python-memcached==1.57 +pymemcache==1.3.5 diff --git a/requirements-py27-dev.txt b/requirements-py27-dev.txt index 78ea9f6036de..da1be46332c0 100644 --- a/requirements-py27-dev.txt +++ b/requirements-py27-dev.txt @@ -1,3 +1,7 @@ +gcloud==0.10.1 +google-api-python-client==1.5.0 +oauth2client==2.0.0.post1 +requests[security]==2.9.1 beautifulsoup4==4.4.1 coverage==4.1b2 Flask==0.10.1 @@ -18,7 +22,7 @@ Werkzeug==0.11.4 nose-timer==0.6.0 Flask-SQLAlchemy==2.1 PyMySQL==0.7.1 -python-memcached==1.57 +pymemcache==1.3.5 PyCrypto==2.6.1 flaky==3.1.0 Django==1.9.2 diff --git a/requirements-py34-dev.txt b/requirements-py34-dev.txt index c0b044fdf10b..98f1168c1782 100644 --- a/requirements-py34-dev.txt +++ b/requirements-py34-dev.txt @@ -1,3 +1,7 @@ +gcloud==0.10.1 +google-api-python-client==1.5.0 +oauth2client==2.0.0.post1 +requests[security]==2.9.1 beautifulsoup4==4.4.1 coverage==4.1b2 Flask==0.10.1 @@ -18,7 +22,7 @@ Werkzeug==0.11.4 nose-timer==0.6.0 Flask-SQLAlchemy==2.1 PyMySQL==0.7.1 -python-memcached==1.57 +pymemcache==1.3.5 PyCrypto==2.6.1 flaky==3.1.0 Django==1.9.2 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index bb5b16b4ed6e..000000000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -gcloud==0.10.1 -google-api-python-client==1.5.0 -oauth2client==2.0.0.post1 -requests[security]==2.9.1 diff --git a/tox.ini b/tox.ini index 4946f9cd4cbd..89c9c1fbd163 100644 --- a/tox.ini +++ b/tox.ini @@ -5,8 +5,6 @@ envlist = pep8, py27, py34, gae [testenv] passenv = * basepython = python2.7 -deps = - -rrequirements.txt examples = bigquery/api blog/introduction_to_data_models_in_cloud_datastore @@ -38,7 +36,6 @@ commands = [testenv:py27] deps = - {[testenv]deps} -rrequirements-py27-dev.txt commands = python scripts/run-tests.py {posargs:{[testenv]examples}} @@ -55,7 +52,6 @@ commands = [testenv:py34] basepython = python3.4 deps = - {[testenv]deps} -rrequirements-py34-dev.txt commands = python scripts/run-tests.py {posargs:{[testenv]examples}} @@ -72,7 +68,6 @@ commands = [testenv:gae] deps = - {[testenv]deps} -rrequirements-py27-dev.txt examples = appengine/app_identity/signing