From 2d313f07be05401638229dcc89ed8c781bb1a32b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 4 May 2018 13:17:34 +0200 Subject: [PATCH] Include coverage for tests It is useful to see if tests itself are covered after all - missing coverage there typically indicates dead/missed code paths. This also uses `source=.` and includes (with run and report), to help Codecov with reporting. Ref: https://github.com/encode/django-rest-framework/pull/5956 --- runtests.py | 7 +++---- setup.cfg | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/runtests.py b/runtests.py index 83642502b..76deff319 100755 --- a/runtests.py +++ b/runtests.py @@ -91,10 +91,9 @@ if __name__ == "__main__": pass else: pytest_args = [ - '--cov-report', - 'xml', - '--cov', - 'rest_framework'] + pytest_args + '--cov', '.', + '--cov-report', 'xml', + ] + pytest_args if first_arg.startswith('-'): # `runtests.py [flags]` diff --git a/setup.cfg b/setup.cfg index e2cb2a812..a073d21f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,3 +19,11 @@ multi_line_output=5 known_standard_library=types known_third_party=pytest,_pytest,django known_first_party=rest_framework + +[coverage:run] +# NOTE: source is ignored with pytest-cov (but uses the same). +source = . +include = rest_framework/*,tests/* +branch = 1 +[coverage:report] +include = rest_framework/*,tests/*