Recursively generating flat XML elements from hierarchical data structure
I think the code could be made better by keeping all of the XML tree-building code together.  The recursive traversal of .sub_scores could be done using a generator function.

Additionally, you might want to reduce the punctuation noise by setting XML attributes using keyword arguments.

class Scorer:
    def generate_report(self, score):
        r = etree.Element('report', user=getpass.getuser(), time=timestamp())
        etree.SubElement(r, 'summary', tests=score.total(), …)
        etree.SubElement(r, 'results', file=self.results_path)
        samples = etree.SubElement(r, 'samples')
        for sample in self._samples(score):
            etree.SubElement(samples, 'sample', sample.report_attr())
        return r

    def _samples(data):
        # Some scores are wrappers that should not be included in output
        if not data.wrapper:
            yield data
        yield from _samples(data.sub_scores)


Alternatively, you could write _samples as a nested function.

class Scorer:
    def generate_report(self, score):
        def extract_samples(data):
            # Some scores are wrappers that should not be included in output
            if not data.wrapper:
                yield data
            yield from extract_samples(data.sub_scores)

        r = etree.Element('report', user=getpass.getuser(), time=timestamp())
        etree.SubElement(r, 'summary', tests=score.total(), …)
        etree.SubElement(r, 'results', file=self.results_path)
        samples = etree.SubElement(r, 'samples')
        for sample in extract_samples(score):
            etree.SubElement(samples, 'sample', sample.report_attr())
        return r