PyCharm unable to load NoseGAE

2019-05-15 04:06发布

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 is set to Nosetests, "All in folder" src/tests. The error happens whether or not --with-gae is passed as a param.

The ensuing failures are indicative of NoseGAE not being loaded:

AssertionError: No api proxy found for service "datastore_v3"

1条回答
趁早两清
2楼-- · 2019-05-15 04:23

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.

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.

查看更多
登录 后发表回答