在 Django cookiecutter / Python 3.x 项目中获取 Pytest 运行
Getting Pytest to run in a Django cookiecutter / Python 3.x project
我正在构建一个新的 cookiecutter-django project. Here are the local setup instructions 我已经关注了它。
当我 运行 "pytest" 时,我在尝试收集时出现以下错误 7 次:
- 收集错误 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_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
包 does not support Python 3 so you get the error. You could change your test discovery 排除 node_modules
.
与 mailhog 的第二个问题看起来无关。您可以尝试将 grunt 命令从 ./mailhog
更改为 /path/to/project/mailhog
。我对grunt不熟悉所以不知道有没有更好的方案改路径
我正在构建一个新的 cookiecutter-django project. Here are the local setup instructions 我已经关注了它。
当我 运行 "pytest" 时,我在尝试收集时出现以下错误 7 次:
- 收集错误 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_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
包 does not support Python 3 so you get the error. You could change your test discovery 排除 node_modules
.
与 mailhog 的第二个问题看起来无关。您可以尝试将 grunt 命令从 ./mailhog
更改为 /path/to/project/mailhog
。我对grunt不熟悉所以不知道有没有更好的方案改路径