Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #1279: Add code coverage of unit tests as MAKE target #1280

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ qt/Makefile
#sphinx doc build
common/doc-dev/_build/doctrees
common/doc-dev/_build/html

# PyCharm IDE project settings
.idea

# coverage result files (raw data and reports)
# .coverage # already ignored, see above
**/htmlcov/**
15 changes: 14 additions & 1 deletion common/configure
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ printf "clean:\n" >> ${MAKEFILE}
printf "\trm -f po/*.mo\n" >> ${MAKEFILE}
printf "\trm -f man/C/*.gz\n" >> ${MAKEFILE}
printf "\trm -f config-example-*.gz\n" >> ${MAKEFILE}
printf "\trm -rf doc-dev/_build/*\n\n" >> ${MAKEFILE}
printf "\trm -rf doc-dev/_build/*\n" >> ${MAKEFILE}
printf "\trm -f .coverage\n" >> ${MAKEFILE}
printf "\trm -rf htmlcov\n" >> ${MAKEFILE}
printf "\n" >> ${MAKEFILE}

#create install and uninstall target
printf "install:\tinstall_translations\n" >> ${MAKEFILE}
Expand Down Expand Up @@ -311,6 +314,16 @@ for v in "" "-v"; do
printf "\n" >> ${MAKEFILE}
done

# For details about the "coverage" package args see:
# https://coverage.readthedocs.io/en/stable/cmd.html
printf "coverage:\n" >> ${MAKEFILE}
printf "\tpython3 -m coverage run --source=.,./plugins,../qt,../qt/plugins --omit */test/* -m unittest -b\n" >> ${MAKEFILE}
printf "\tpython3 -m coverage report\n" >> ${MAKEFILE}
printf "\t# To show an interactive HTML coverage report use:\n" >> ${MAKEFILE}
printf "\t# python3 -m coverage html\n" >> ${MAKEFILE}
printf "\t# firefox htmlcov/index.html\n" >> ${MAKEFILE}
printf "\n" >> ${MAKEFILE}

printf "integrationtest:\n" >> ${MAKEFILE}
printf "\ttest/test.sh\n" >> ${MAKEFILE}

Expand Down
6 changes: 6 additions & 0 deletions common/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# This main file is required to run all unit tests in the "test" folder
# without specifying each test file name in the command line.
# See also:
# https://stackoverflow.com/a/43733357
# https://docs.python.org/3/library/unittest.html#test-discovery

from test import *

if __name__ == '__main__':
Expand Down