python - Coverage failing on Travis but not on local machine - error depends on order of flags -


i'm have following script section in .travis.yml file:

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

this works fine on own (windows) machine, throws error on both linux , osx on travis build. error is:

import filename not supported.

with flags in different order see different error (only on linux build - osx tests pass order of flags):

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

can't find '__main__' module in 'mymodule/tests/geometry_tests'

what doing wrong here?

solved changing using coverage directly using pytest-cov.

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

and .coveragerc file:

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

i don't know why works previous approach didn't, @ least solves problem.


Comments