def test_empty_results(self): self.results_xml.write('<?xml version="1.0"?>' '<unittest-results>' '</unittest-results>') self.results_xml.close() pythontools.unittest(self.ctxt, self.results_xml.name) type, category, generator, xml = self.ctxt.output.pop() self.assertEqual(Recipe.REPORT, type) self.assertEqual('test', category) self.assertEqual(0, len(xml.children))
def test_missing_file_attribute(self): self.results_xml.write('<?xml version="1.0"?>' '<unittest-results>' '<test duration="0.12" status="success"' ' name="test_foo (pkg.BarTestCase)"/>' '</unittest-results>') self.results_xml.close() pythontools.unittest(self.ctxt, self.results_xml.name) type, category, generator, xml = self.ctxt.output.pop() self.assertEqual(1, len(xml.children)) self.assertEqual(None, xml.children[0].attr.get('file'))
def test_file_path_normalization(self): self.results_xml.write('<?xml version="1.0"?>' '<unittest-results>' '<test duration="0.12" status="success"' ' file="%s"' ' name="test_foo (pkg.BarTestCase)"/>' '</unittest-results>' % os.path.join(self.ctxt.basedir, 'bar_test.py')) self.results_xml.close() pythontools.unittest(self.ctxt, self.results_xml.name) type, category, generator, xml = self.ctxt.output.pop() self.assertEqual(1, len(xml.children)) self.assertEqual('bar_test.py', xml.children[0].attr['file'])