2016-08-08 7 views
0

の順序に依存し、私は私の.travis.ymlファイルに次のscriptのセクションを持っている:カバレッジ - エラーがフラグ

script: 
    # run all tests in mymodule/tests and check coverage of the mymodule dir 
    # don't report on coverage of files in the mymodule/tests dir itself 
    - coverage run -m --source mymodule --omit mymodule/tests/* py.test mymodule/tests -v 

これは私自身で正常に動作します(Windowsの)マシンで動作しますが、TravisビルドでLinuxとOSXの両方でエラーが発生します。エラーは次のとおりです。

ファイル名でのインポートはサポートされていません。私は(唯一のLinuxビルドに - OSXのテストでは、フラグの順に渡す)別のエラーが表示され、異なる順序でフラグで

-coverage run --source eppy --omit eppy/tests/* -m py.test eppy/tests -v 

見つけることができません'mymodule/tests/geometry_tests'の '__main__'モジュール

私はここで間違っていますか?

答えて

0

coverageをそのままpytest-covに変更して解決しました。

script: 
    # run all tests in mymodule/tests and check coverage of the mymodule dir 
    - py.test -v --cov-config .coveragerc --cov=mymodule mymodule/tests 

そして.coveragercファイル:

# .coveragerc to control coverage.py 
[run] 
# don't report on coverage of files in the tests dir itself 
omit = 
    mymodule/tests/* 

以前のアプローチはしなかったところ、この作品、なぜ私は知らないが、これは、少なくとも問題を解決します。

関連する問題