让Pytest在Django cookiecutter / Python 3.x项目中运行

时间:2017-11-23 15:32:39

标签: django node-modules cookiecutter-django

我正在构建一个新的cookiecutter-django项目。以下是我遵循的local setup instructions

当我运行“ pytest ”时,我尝试收集时会出现以下错误7次:

  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / MSVSSettings_test.py
  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / common_test.py
  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / easy_xml_test.py
  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / input_test.py
  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / generator / msvs_test.py
  • ERROR收集node_modules / node-gyp / gyp / pylib / gyp / generator / ninja_test.py
  • ERROR收集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
    

有什么想法吗?谢谢 -

1 个答案:

答案 0 :(得分:2)

pytest正在尝试加载node_modules目录。 node_modulesdoes not support Python 3,以便您收到错误消息。您可以更改test discovery以排除./mailhog

mailhog的第二个问题看起来无关紧要。您可以尝试将grunt命令从/path/to/project/mailhog更改为if (vidRank == 1) { await fb.child('UserVideo/${userid}/Vid1').onValue.listen((Event event){ if (event.snapshot != null){ var vid1id = event.snapshot.value['videoID'].toString(); fb.child('NumberOnes/${vid1id}').onValue.listen((Event onesEvent){ if (onesEvent.snapshot != null){ var onesValue = (onesEvent.snapshot.value['Value'] as int); final vidValue = onesValue - 1; print("Inside ${vidValue}"); fb.child('NumberOnes/${vid1id}').update({ 'Value': vidValue }); } }); } }); 。我不熟悉咕噜声,所以我不知道是否有更好的解决方案来改变路径。