3

I am building a new cookiecutter-django project. Here are the local setup instructions which I've followed.

When I run "pytest" I get the following error 7 times when it tries to collect:

  • 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
    

Any ideas? Thank you-

Emile
  • 3,464
  • 8
  • 46
  • 77
  • pytest is trying to load your node_modules directory. The `node-gyp` package [does not support Python 3](https://github.com/nodejs/node-gyp#on-unix) so you get the error. You could change your [test discovery](https://docs.pytest.org/en/latest/example/pythoncollection.html) to exclude `node_modules`. – Alasdair Nov 23 '17 at 15:49
  • @Alasdair that would answer that. Much appreciated – Emile Nov 23 '17 at 15:52

1 Answers1

3

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.

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.

Alasdair
  • 298,606
  • 55
  • 578
  • 516