I am unable to run coverage.py in the tests directory from a Python project. I have a tests directory containing an __init__.py
file and some test_*.py
files where I define the tests I want to run in the __main__
block of every test file.
The tests directory is located in the same folder as the .travis.yml
file which looks like:
The script block works when I run a single file as coverage run tests/test_errors.py
, but whenever I try to run all the files in the directory it does not work.
I have tried the following solutions:
How can pytest-cov report coverage of python code that is executed as a result of pexpect.spawn? => which did not work for me as Travis-CI debugger said there was no data to combine, and this solution is not excatly what I am looking for, as the most efficient way is not to list all the test files, just the directory I guess.
Python coverage: running more than 1 test => this solution works but the coverage just is made in the tests directory, and I want to test the coverage of the whole project in codecov. To clarify, codecov shows:
Whenever I run the coverage for a single file, codecov outputs this:
Which is what I am looking for, but when it comes to testing multiple Python files contained in the tests directory. Because as you can see, that is the codecov output when coverage run tests/test_investpy.py
not for the whole `tests/' directory.
Any help or information is welcomed! An thank you in advance!
(NOTE: for further information about the project structure you can check the project in https://github.com/alvarob96/investpy as it is an Open Source Project)