def writeCSV(self, data, fileName):
    "\n    Write out data in a csv file.\n    Assumes a data structure with:\n\n    {'id1' : {'f1':n1, 'f2':n2}, 'id2' : {'f1':n3, 'f2':n4}}\n    "
    if (len(self._testedSet) > 0):
        with open(fileName, 'w') as csvFile:
            csvFileWriter = csv.writer(csvFile, lineterminator='\n')
            testedCases = sorted(self._testedSet)
            header = sorted(data[testedCases[0]].keys())
            header = (['testCase'] + header)
            csvFileWriter.writerow(header)
            for testCase in testedCases:
                thisCase = data[testCase]
                thisCase['testCase'] = testCase
                row = []
                for h in header:
                    row = (row + [thisCase.get(h, 'N/A')])
                csvFileWriter.writerow(row)
            self._logger.info('Wrote to file %s', fileName)
    else:
        self._logger.info('No test cases run, aborting file write to %s', fileName)
Write out data in a csv file.
Assumes a data structure with:

{'id1' : {'f1':n1, 'f2':n2}, 'id2' : {'f1':n3, 'f2':n4}}
def writeCSV(self, data, fileName):
    "\n    Write out data in a csv file.\n    Assumes a data structure with:\n\n    {'id1' : {'f1':n1, 'f2':n2}, 'id2' : {'f1':n3, 'f2':n4}}\n    "
    if (len(self._testedSet) > 0):
        with open(fileName, 'w') as csvFile:
            csvFileWriter = csv.writer(csvFile, lineterminator='\n')
            testedCases = sorted(self._testedSet)
            header = sorted(data[testedCases[0]].keys())
            header = (['testCase'] + header)
            csvFileWriter.writerow(header)
            for testCase in testedCases:
                thisCase = data[testCase]
                thisCase['testCase'] = testCase
                row = []
                for h in header:
                    row = (row + [thisCase.get(h, 'N/A')])
                csvFileWriter.writerow(row)
            self._logger.info('Wrote to file %s', fileName)
    else:
        self._logger.info('No test cases run, aborting file write to %s', fileName)