我没有进行单元测试。
我正在使用Python2.7在我的Windows10机器上运行以下两个命令,我得到了臭名昭着的断言错误:
没有为服务找到api代理" memcache"
这是代码:
import cloudstorage as cstorage
cstorage.copy2("/nosuchbucket/nosuchfile1","/nosuchbucket/nosuchfile2")
关于可能出错的任何指示?
环境:
答案 0 :(得分:0)
该特定库是AppEngine Google Cloud Storage客户端库,旨在供GAE应用程序代码使用。
此类代码无法像您尝试的那样以独立方式执行,需要在GAE沙箱环境内部执行(并由其补充)(部署时本地开发服务器或实际GAE基础架构)。
另请参阅相关的import cloudstorage, ImportError: No module named google.appengine.api
答案 1 :(得分:0)
昨天我也找到了一种解决方法,可以用于测试。
只需导入测试床并初始化必要的存根(或全部存根)
从google.appengine.ext导入测试平台 testbed = testbed.Testbed()
testbed.activate()
testbed.init_datastore_v3_stub()
testbed.init_memcache_stub()
testbed.init_urlfetch_stub()
testbed.init_app_identity_stub()
testbed.init_blobstore_stub()
现在错误消失了,我可以使用cloudstorage API。