From 97f05c988545f8ca588253fd325401c4834543b6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 30 Jun 2020 08:03:45 -0400 Subject: --skip-empty now applies to the XML report also. #976 --- coverage/xmlreport.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'coverage/xmlreport.py') 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("\\", "/") -- cgit v1.2.1