appengine python本地单元测试urlfetch_stub.py fancy_urllib模块没有属性';无效证书例外';

appengine python本地单元测试urlfetch_stub.py fancy_urllib模块没有属性';无效证书例外';,python,testing,google-app-engine-python,urlfetch,Python,Testing,Google App Engine Python,Urlfetch,我正在使用linux和google cloud sdk应用程序引擎python包,安装版本为196.0.0-0 我尝试创建本地单元测试,参考文献[1] class ViewsTestCase(unittest.TestCase): def setUp(self): self.client = application.test_client() self.client.testing = True self.testbed = testbe

我正在使用linux和google cloud sdk应用程序引擎python包,安装版本为196.0.0-0

我尝试创建本地单元测试,参考文献[1]

class ViewsTestCase(unittest.TestCase):

    def setUp(self):
        self.client = application.test_client()
        self.client.testing = True
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_urlfetch_stub()

    def tearDown(self):
        self.testbed.deactivate()
添加PYTHONPATH环境变量:

export PYTHONPATH="$PYTHONPATH:/usr/lib/google-cloud-sdk/platform/google_appengine:/usr/lib/google-cloud-sdk/platform/google_appengine/lib:/usr/lib/google-cloud-sdk/platform/google_appengine/lib/yaml/lib"
然后我试着运行它

$ python test_views.py 
Traceback (most recent call last):
  File "test_views.py", line 6, in <module>
    from google.appengine.ext import testbed
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/ext/testbed/__init__.py", line 130, in <module>
from google.appengine.api import urlfetch_stub
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/urlfetch_stub.py", line 32, in <module>
_fancy_urllib_InvalidCertException = fancy_urllib.InvalidCertificateException
AttributeError: 'module' object has no attribute 'InvalidCertificateException'
我已经试着给PYTHONPATH添加了花式的库

export PYTHONPATH="$PYTHONPATH:/usr/lib/google-cloud-sdk/platform/google_appengine:/usr/lib/google-cloud-sdk/platform/google_appengine/lib:/usr/lib/google-cloud-sdk/platform/google_appengine/lib/yaml/lib:/usr/lib/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib"
但还是失败了

有线索吗

多谢各位

[1]


[2]

如果看到init.py的文件长度为“0”,并且存在同名子文件夹(即lib/fancy_urllib/fancy_urllib),则将子文件夹的两个文件(.py和.pyc)复制到上一个文件夹。这对我很管用

我什么也没做就在CI中得到了这个,仍然在本地机器上工作。你找到解决办法了吗?
export PYTHONPATH="$PYTHONPATH:/usr/lib/google-cloud-sdk/platform/google_appengine:/usr/lib/google-cloud-sdk/platform/google_appengine/lib:/usr/lib/google-cloud-sdk/platform/google_appengine/lib/yaml/lib:/usr/lib/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib"