PyCharm无法加载NoseGAE [英] PyCharm unable to load NoseGAE

查看:190
本文介绍了PyCharm无法加载NoseGAE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在PyCharm中创建了一个鼻子测试配置.我在工作的virtualenv中安装了NoseGAE.使用./env/bin/nosetests --with-gae src/tests从终端运行测试效果很好.但是,PyCharm测试配置可以产生

I've created a nose test config in PyCharm. I have NoseGAE installed in the virtualenv where I'm working. Running tests from the terminal with ./env/bin/nosetests --with-gae src/tests works great. The PyCharm test config, however, yields

/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)

Config设置为Nosetests,全部位于文件夹中" src/tests.无论是否将--with-gae作为参数传递,都会发生错误.

Config is set to Nosetests, "All in folder" src/tests. The error happens whether or not --with-gae is passed as a param.

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

The ensuing failures are indicative of NoseGAE not being loaded:

AssertionError: No api proxy found for service "datastore_v3"

推荐答案

通过运行pip install --upgrade setuptools确保具有最新的pkg_resources.然后将要使用的pkg_resources版本添加到路径的开头.在PyCharm中,您可以通过在测试配置中添加一个环境变量来做到这一点:PYTHONPATH=/path/to/site-packages:$PYTHONPATH.

Make sure you have the latest pkg_resources by running pip install --upgrade setuptools. Then add the version of pkg_resources you want to be using to the front of your path. In PyCharm you can do this by adding an environment variable to the test configuration: PYTHONPATH=/path/to/site-packages:$PYTHONPATH.

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

This is happening because PyCharm, when support for Google App Engine is enabled (under "Languages & Frameworks"), inserts a bunch of GAE SDK directories to the front of the PYTHONPATH. The Python GAE SDK ships with setuptools-0.6c11, a version of setuptools from 2009. This has a very old version of pkg_resources bundled with it, which doesn't work with newer nose plugins.

这篇关于PyCharm无法加载NoseGAE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆