Skip to content

Commit c17b4ad

Browse files
blueyedtomchristie
authored andcommitted
Include coverage for tests (#5970)
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: #5956
1 parent 275c157 commit c17b4ad

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

runtests.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ def is_class(string):
9191
pass
9292
else:
9393
pytest_args = [
94-
'--cov-report',
95-
'xml',
96-
'--cov',
97-
'rest_framework'] + pytest_args
94+
'--cov', '.',
95+
'--cov-report', 'xml',
96+
] + pytest_args
9897

9998
if first_arg.startswith('-'):
10099
# `runtests.py [flags]`

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ multi_line_output=5
1919
known_standard_library=types
2020
known_third_party=pytest,_pytest,django
2121
known_first_party=rest_framework
22+
23+
[coverage:run]
24+
# NOTE: source is ignored with pytest-cov (but uses the same).
25+
source = .
26+
include = rest_framework/*,tests/*
27+
branch = 1
28+
[coverage:report]
29+
include = rest_framework/*,tests/*

0 commit comments

Comments
 (0)