2

pytest-djangoを使用して Django アプリをテストするときに、Travis で奇妙な問題が発生しています。私のすべてのテストはローカルで、明らかにtravisでも合格しますが、何をしても毎回エラーが発生しnode-sassますnode-gyp

私のテストでは、ノードモジュールを使用していません(可能であれば)。私は gulp-sass を持つ gulp を使用していますが、テストを実行する前に実行するとうまくいくようです。

エラー出力は次のとおりです。

$ py.test --ds=<project>.settings.travis
============================= test session starts ==============================
platform linux -- Python 3.4.2 -- py-1.4.26 -- pytest-2.6.4
django settings: <project>.settings.travis (from command line option)
plugins: django
collected 13 items / 7 errors 
<project>/tests/test_<suite_1>.py ..........
<project>/tests/test_<suite_2>.py ...
==================================== ERRORS ====================================
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/common_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/input_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
 ERROR collecting node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=True)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/py/_path/local.py:629: in pyimport
    __import__(pkgpath.basename)
E     File "/home/travis/build/<user>/<project>/node_modules/gulp-sass/node_modules/node-sass/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
===================== 13 passed, 7 error in 20.94 seconds ======================
4

1 に答える 1

0

pytest問題は、 の依存関係を満たす Travis に既にインストールされている の (古い) バージョンであることが判明しましたpytest-django。の正しいバージョンを追加すると、問題pytestrequirements.txt修正されました。

于 2016-01-24T15:34:22.230 に答える