nodes2 は、シェバン行で構成されているすべての python を取ります。
python2 プロジェクトの使用をテストするには (実行可能ファイルとパスはマシンによって異なる場合があります):
python2.7 /usr/local/bin/nose2
この例で検証:
test.py :
def test_the_program():
print "foo"
python3 で:
$ python3 /usr/local/bin/nose2
======================================================================
ERROR: test (nose2.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test
(...)
print "hans"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
python2.7 で:
$ python2.7 /usr/local/bin/nose2
foo
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK