问题描述
我正在建立一个新的 cookiecutter-django 项目.这是我遵循的本地设置说明.
I am building a new cookiecutter-django project. Here are the local setup instructions which I've followed.
当我运行" pytest "时,尝试收集时会出现以下7次错误:
When I run "pytest" I get the following error 7 times when it tries to collect:
- 错误收集node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
- 收集node_modules/node-gyp/gyp/pylib/gyp/common_test.py时出错
- 收集node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py时出错
- 收集node_modules/node-gyp/gyp/pylib/gyp/input_test.py时出错
- 收集node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py时出错
- 收集node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py时出错
-
收集节点模块/node-gyp/gyp/pylib/gyp/generator/xcode_test.py时出错
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/common_test.py
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/input_test.py
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py
- ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py
ERROR collecting node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py
../../Envs/kishikoi/lib/python3.6/site-packages/_pytest/python.py:395: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
../../Envs/kishikoi/lib/python3.6/site-packages/py/_path/local.py:662: in pyimport
__import__(modname)
E File "/Users/emilepetrone/Sites/kishikoi/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 37
E print '%s:%s:%d:%s %s' % (mode.upper(), os.path.basename(ctx[0]),
E ^
E SyntaxError: invalid syntax
有什么想法吗?谢谢-
推荐答案
pytest试图加载您的node_modules目录. node-gyp
包不支持Python 3 因此您会收到错误消息.您可以更改您的测试发现以排除 node_modules 代码>.
pytest is trying to load your node_modules directory. The node-gyp
package does not support Python 3 so you get the error. You could change your test discovery to exclude node_modules
.
mailhog的第二个问题看起来无关紧要.您可以尝试将grunt命令从 ./mailhog
更改为/path/to/project/mailhog
.我不熟悉咕unt咕so的声音,所以我不知道是否有更好的解决方案来更改路径.
The second issue with mailhog looks unrelated. You could try changing the grunt command from ./mailhog
to /path/to/project/mailhog
. I'm unfamiliar with grunt so I don't know if there's a better solution to change the path.
这篇关于使Pytest在Django cookiecutter/Python 3.x项目中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!