Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 def out_of_scope_tempxmlfile():
     tmpf = xml_utils.TempXMLFile()
     return tmpf.name
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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))