PyCharm无法加载NoseGAE

bra*_*nes 3 google-app-engine nose pycharm nose-gae

我在PyCharm中创建了一个鼻子测试配置.我在我工作的virtualenv中安装了NoseGAE.从终端运行测试./env/bin/nosetests --with-gae src/tests工作得很好.然而,PyCharm测试配置产生了

/Users/bistenes/Code/myproject/env/bin/python /Applications/PyCharm.app/Contents/helpers/pycharm/noserunner.py src/tests/
Testing started at 6:31 PM ...

/Users/bistenes/Code/myproject/env/lib/python2.7/site-packages/nose/plugins/manager.py:395: RuntimeWarning: Unable to load plugin nosegae = nosegae:NoseGAE: nose>=0.10.1
  RuntimeWarning)
Run Code Online (Sandbox Code Playgroud)

Config设置为Nosetests,"All in folder" src/tests.无论是否--with-gae作为参数传递,都会发生错误.

随后的失败表明NoseGAE未加载:

AssertionError: No api proxy found for service "datastore_v3"
Run Code Online (Sandbox Code Playgroud)

bra*_*nes 7

确保你有最新pkg_resources的运行pip install --upgrade setuptools.然后将pkg_resources要使用的版本添加到路径的前面.在PyCharm中,您可以通过向测试配置添加环境变量来实现此目的:PYTHONPATH=/path/to/site-packages:$PYTHONPATH.

发生这种情况是因为PyCharm启用了对Google App Engine的支持(在"语言和框架"下),将一堆GAE SDK目录插入到PYTHONPATH的前面.Python GAE SDK附带了setuptools-0.6c11一个2009年版本的setuptools.它有一个非常旧版本的pkg_resources捆绑,它不适用于较新的鼻子插件.