Anonymous avatar Anonymous committed 22cf0f5

Handle slaves not returning any data.

Comments (0)

Files changed (1)


     def terminal_summary(self, terminalreporter):
         config = terminalreporter.config
+        terminalwriter = terminalreporter._tw
         cov_packages = config.getvalue('cov_packages')
         cov_terminal = config.getvalue('cov_terminal')
         for cov, node_descs in self.covs:
             if cov_terminal:
-                terminalwriter = terminalreporter._tw
                 if len(node_descs) == 1:
                     terminalwriter.sep('-', 'coverage: %s' % ''.join(node_descs))
                         xml_file = cov_xml_file
                     cov.xml_report(morfs, xml_file, cov_ignore_errors, cov_omit_prefixes)
+        if self.failed_slaves:
+            terminalwriter.sep('-', 'coverage: failed slaves')
+            terminalwriter.write('The following slaves failed to return coverage data, '
+                                 'ensure that pytest-cov is installed on these slaves.\n')
+            for node in self.failed_slaves:
+                terminalwriter.write('%s\n' %
 class Central(CovController):
     """Implementation for centralised operation."""
     def sessionstart(self, session):
         import coverage
+        self.failed_slaves = []
         if session.config.getvalue('cov_config'):
             config_file = session.config.getvalue('cov_config_file')
     def sessionstart(self, session):
         self.config = session.config
         self.data_files = {}
+        self.failed_slaves = []
     def configure_node(self, node):
         import socket
         node.slaveinput['cov_master_rsync_roots'] = node.nodemanager.roots
     def testnodedown(self, node, error):
+        if not (hasattr(node, 'slaveoutput') and
+                'cov_slave_data_file' in node.slaveoutput):
+            self.failed_slaves.append(node)
+            return
         if 'cov_slave_data_suffix' in node.slaveoutput:
             import coverage
             if self.config.getvalue('cov_config'):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.