summaryrefslogtreecommitdiff
path: root/coverage/xmlreport.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-06-30 08:03:45 -0400
committerNed Batchelder <ned@nedbatchelder.com>2020-06-30 08:03:45 -0400
commit97f05c988545f8ca588253fd325401c4834543b6 (patch)
tree41b223ce1a1bf1f33aaad9ffd41351156ad92da6 /coverage/xmlreport.py
parentd00f254315ef4e97e86e230c448d6325c97e08dc (diff)
downloadpython-coveragepy-git-97f05c988545f8ca588253fd325401c4834543b6.tar.gz
--skip-empty now applies to the XML report also. #976nedbat/bug976
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r--coverage/xmlreport.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index ad44775f..6d012ee6 100644
--- a/coverage/xmlreport.py
+++ b/coverage/xmlreport.py
@@ -142,6 +142,10 @@ class XmlReporter(object):
def xml_file(self, fr, analysis, has_arcs):
"""Add to the XML report for a single file."""
+ if self.config.skip_empty:
+ if analysis.numbers.n_statements == 0:
+ return
+
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
filename = fr.filename.replace("\\", "/")