简体   繁体   English

PyCharm无法加载NoseGAE

[英]PyCharm unable to load NoseGAE

I've created a nose test config in PyCharm. 我在PyCharm中创建了一个鼻子测试配置。 I have NoseGAE installed in the virtualenv where I'm working. 我在我工作的virtualenv中安装了NoseGAE。 Running tests from the terminal with ./env/bin/nosetests --with-gae src/tests works great. 使用./env/bin/nosetests --with-gae src/tests tests从终端运行测试效果很好。 The PyCharm test config, however, yields 然而,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)

Config is set to Nosetests, "All in folder" src/tests . Config设置为Nosetests,“All in folder” src/tests The error happens whether or not --with-gae is passed as a param. 无论是否将--with-gae作为参数传递,都会发生错误。

The ensuing failures are indicative of NoseGAE not being loaded: 随后的失败表明NoseGAE未加载:

AssertionError: No api proxy found for service "datastore_v3"

Make sure you have the latest pkg_resources by running pip install --upgrade setuptools . 请确保您有最新的pkg_resources运行pip install --upgrade setuptools Then add the version of pkg_resources you want to be using to the front of your path. 然后将要使用的pkg_resources版本添加到路径的前面。 In PyCharm you can do this by adding an environment variable to the test configuration: PYTHONPATH=/path/to/site-packages:$PYTHONPATH . 在PyCharm中,您可以通过向测试配置添加环境变量来实现此目的: PYTHONPATH=/path/to/site-packages:$PYTHONPATH

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM