Пример #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)
Пример #2
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)
     del tmpf
Пример #3
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))
Пример #4
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))
Пример #5
0
 def out_of_scope_tempxmlfile():
     tmpf = xml_utils.TempXMLFile()
     return tmpf.name