$ nosetests --with-gae --gae-lib-root=~/google-cloud-sdk/platform/google_appengine
Traceback (most recent call last):
File "/Users/edahl/src/gmj/bin/nosetests", line 9, in <module>
load_entry_point('nose==1.3.4', 'console_scripts', 'nosetests')()
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/core.py", line 121, in __init__
**extra_args)
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/core.py", line 145, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/config.py", line 346, in configure
self.plugins.configure(options, self)
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/plugins/manager.py", line 284, in configure
cfg(options, config)
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "/Users/edahl/src/gmj/lib/python2.7/site-packages/nosegae.py", line 80, in configure
from dev_appserver import fix_sys_path
ImportError: No module named dev_appserver
这是我在google_appengine目录中看到的内容......
$ ls ~/google-cloud-sdk/platform/google_appengine/
BUGS api_server.py godoc php
LICENSE backends_conversion.py gofmt php_cli.py
README bulkload_client.py google remote_api_shell.py
RELEASE_NOTES bulkloader.py google_sql.py run_tests.py
RELEASE_NOTES.go_sdk demos goroot tools
VERSION download_appstats.py lib wrapper_util.py
_php_runtime.py gen_protorpc.py new_project_template wrapper_util.pyc
_python_runtime.py goapp old_dev_appserver.py
旧的/ usr / local / google_appengine目录似乎已被弃用......但如果我使用它,我可以让事情有效。
[更新]
使用old_dev_appserver这样的手动单元测试设置确实有效:
def main(sdk_path, test_path):
sys.path.insert(0, sdk_path)
import old_dev_appserver
old_dev_appserver.fix_sys_path()
suite = unittest.loader.TestLoader().discover(test_path)
unittest.TextTestRunner(verbosity=2).run(suite)
答案 0 :(得分:2)
最后这非常愚蠢......需要扩展传递给--gae-lib-root
的用户路径nosetests --with-gae --gae-lib-root=/Users/USERNAME/google-cloud-sdk/platform/google_appengine
答案 1 :(得分:1)
在我的Mac上,我收到同样的错误:
简单的解决方案就是启动GoogleAppEngineLauncher。这会更新nosetests所需的sym链接。
希望这适合你。
答案 2 :(得分:0)
您可能需要设置该目录下lib文件夹的路径:
--gae-lib-root=~/google-cloud-sdk/platform/google_appengine/lib
但您可能还需要设置PATH变量,因此它也包含/ bin:
export PATH=$PATH:~/google-cloud-sdk/platform/google_appengine/bin
如果这些都不适合您,请尝试添加不带沙盒的开关:
nosetests -s -v --with-gae --without-sandbox
答案 3 :(得分:0)
根据NoseGAE文档,它检查google-cloud-sdk的默认位置在/usr/local/google_appengine
中。
将google-cloud-sdk
文件夹移至/usr/local/google_appengine/google-cloud-sdk/
对我来说已经解决了这个问题。