Skip to content

Commit

Permalink
Report on failed workers before trying to report their data
Browse files Browse the repository at this point in the history
cov.report() will fail, preventing us from mentioning the failed
workers, so do the failed workers first.
  • Loading branch information
nedbat committed Sep 7, 2019
1 parent a25ff08 commit 4d6b3fe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pytest_cov/engine.py
Expand Up @@ -97,6 +97,14 @@ def summary(self, stream):
for node_desc in sorted(self.node_descs):
self.sep(stream, ' ', '%s' % node_desc)

# Report on any failed workers.
if self.failed_workers:
self.sep(stream, '-', 'coverage: failed workers')
stream.write('The following workers failed to return coverage data, '
'ensure that pytest-cov is installed on these workers.\n')
for node in self.failed_workers:
stream.write('%s\n' % node.gateway.id)

# Produce terminal report if wanted.
if any(x in self.cov_report for x in ['term', 'term-missing']):
options = {
Expand Down Expand Up @@ -131,14 +139,6 @@ def summary(self, stream):
total = self.cov.xml_report(ignore_errors=True, outfile=self.cov_report['xml'])
stream.write('Coverage XML written to file %s\n' % self.cov_report['xml'])

# Report on any failed workers.
if self.failed_workers:
self.sep(stream, '-', 'coverage: failed workers')
stream.write('The following workers failed to return coverage data, '
'ensure that pytest-cov is installed on these workers.\n')
for node in self.failed_workers:
stream.write('%s\n' % node.gateway.id)

return total


Expand Down

0 comments on commit 4d6b3fe

Please sign in to comment.