def test_TempXMLFile_explicit(self): tmpf = xml_utils.TempXMLFile() tmpf_name = tmpf.name # Assert this does NOT raise an exception os.stat(tmpf_name) del tmpf self.assertRaises(OSError, os.stat, tmpf_name)
def test_test_TempXMLFile_canread(self): tmpf = xml_utils.TempXMLFile() tmpf.write(self.XMLSTR) tmpf.seek(0) stuff = tmpf.read() self.assertEqual(stuff, self.XMLSTR) del tmpf
def test_write_other_changed(self): xmlbackup = self.class_to_test(self.XMLSTR) otherfile = xml_utils.TempXMLFile() wordsize = xmlbackup.find('guest/arch/wordsize') wordsize.text = str(64) xmlbackup.write(otherfile) otherfile.close() xmlbackup.write(self.XMLFILE) xmlbackup.close() self.canonicalize_test_xml() self.assertTrue(self.is_same_contents(otherfile.name))
def test_write_other(self): xmlbackup = self.class_to_test(self.XMLFILE) otherfile = xml_utils.TempXMLFile() xmlbackup.write(otherfile) otherfile.close() self.assertTrue(self.is_same_contents(otherfile.name))
def out_of_scope_tempxmlfile(): tmpf = xml_utils.TempXMLFile() return tmpf.name