Index: test/sasdataloader/test/utest_cansas.py
===================================================================
--- test/sasdataloader/test/utest_cansas.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ test/sasdataloader/test/utest_cansas.py	(revision 17c943656cb7c598b2d5cf9530ed6227d88ae6f9)
@@ -46,5 +46,6 @@
         self.schema_1_0 = "cansas1d_v1_0.xsd"
         self.schema_1_1 = "cansas1d_v1_1.xsd"
-
+        self.write_1_0_filename = "isis_1_0_write_test.xml"
+        self.write_1_1_filename = "isis_1_1_write_test.xml"
 
     def get_number_of_entries(self, dictionary, name, i):
@@ -56,5 +57,4 @@
         return name
 
-
     def test_invalid_xml(self):
         """
@@ -62,6 +62,5 @@
         """
         invalid = StringIO.StringIO('<a><c></b></a>')
-        reader = XMLreader(invalid)
-
+        XMLreader(invalid)
 
     def test_xml_validate(self):
@@ -82,5 +81,4 @@
         self.assertFalse(xmlschema.validate(invalid))
 
-
     def test_real_xml(self):
         reader = XMLreader(self.xml_valid, self.schema_1_0)
@@ -90,5 +88,4 @@
         else:
             self.assertFalse(valid)
-
 
     def _check_data(self, data):
@@ -105,12 +102,9 @@
         self.assertTrue(data.meta_data["xmlpreprocess"] is not None)
 
-
     def _check_data_1_1(self, data):
         spectrum = data.trans_spectrum[0]
         self.assertTrue(len(spectrum.wavelength) == 138)
 
-
     def test_cansas_xml(self):
-        filename = "isis_1_1_write_test.xml"
         xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
         valid = xmlreader.validate_xml()
@@ -118,5 +112,6 @@
         self.assertTrue(valid)
         fo = open(self.isis_1_1)
-        str = fo.read()
+        fo.read()
+        fo.close()
         reader_generic = Loader()
         dataloader = reader_generic.load(self.isis_1_1)
@@ -128,12 +123,14 @@
             self._check_data(cansasreader[i])
             self._check_data_1_1(cansasreader[i])
-            reader_generic.save(filename, dataloader[i], None)
-            fo = open(filename)
-            str = fo.read()
+            reader_generic.save(self.write_1_1_filename, dataloader[i], None)
+            fo = open(self.write_1_1_filename)
+            fo.read()
+            fo.close()
             reader2 = Loader()
-            return_data = reader2.load(filename)
+            return_data = reader2.load(self.write_1_1_filename)
             written_data = return_data[0]
             self._check_data(written_data)
-
+        if os.path.isfile(self.write_1_1_filename):
+            os.remove(self.write_1_1_filename)
 
     def test_double_trans_spectra(self):
@@ -144,5 +141,4 @@
         for item in data:
             self._check_data(item)
-
 
     def test_entry_name_recurse(self):
@@ -155,7 +151,5 @@
         self.assertTrue(len(d) == 6)
 
-
     def test_load_cansas_file(self):
-        valid = []
         reader1 = XMLreader(self.xml_valid, self.schema_1_0)
         self.assertTrue(reader1.validate_xml())
@@ -173,5 +167,4 @@
         self.assertFalse(reader7.validate_xml())
 
-
     def test_invalid_cansas(self):
         list = self.loader.load(self.cansas1d_notitle)
@@ -184,10 +177,9 @@
         self.assertTrue(data.detector[0].distance == 4150)
 
-
     def test_old_cansas_files(self):
         reader1 = XMLreader(self.cansas1d, self.schema_1_0)
         self.assertTrue(reader1.validate_xml())
         file_loader = Loader()
-        file1 = file_loader.load(self.cansas1d)
+        file_loader.load(self.cansas1d)
         reader2 = XMLreader(self.cansas1d_units, self.schema_1_0)
         self.assertTrue(reader2.validate_xml())
@@ -197,7 +189,5 @@
         self.assertTrue(reader4.validate_xml())
 
-
     def test_save_cansas_v1_0(self):
-        filename = "isis_1_0_write_test.xml"
         xmlreader = XMLreader(self.isis_1_0, self.schema_1_0)
         valid = xmlreader.validate_xml()
@@ -210,13 +200,14 @@
             self._check_data(dataloader[i])
             self._check_data(cansasreader[i])
-            reader_generic.save(filename, dataloader[i], None)
+            reader_generic.save(self.write_1_0_filename, dataloader[i], None)
             reader2 = Reader()
-            return_data = reader2.read(filename)
+            return_data = reader2.read(self.write_1_0_filename)
             written_data = return_data[0]
-            xmlwrite = XMLreader(filename, self.schema_1_0)
+            XMLreader(self.write_1_0_filename, self.schema_1_0)
             valid = xmlreader.validate_xml()
             self.assertTrue(valid)
             self._check_data(written_data)
-
+        if os.path.isfile(self.write_1_0_filename):
+            os.remove(self.write_1_0_filename)
 
     def test_processing_instructions(self):
@@ -224,5 +215,5 @@
         valid = reader.validate_xml()
         if valid:
-            ## find the processing instructions and make into a dictionary
+            # find the processing instructions and make into a dictionary
             dic = self.get_processing_instructions(reader)
             self.assertTrue(dic == {'xml-stylesheet': \
@@ -232,8 +223,7 @@
             xmldoc = minidom.parseString(xml)
 
-            ## take the processing instructions and put them back in
+            # take the processing instructions and put them back in
             xmldoc = self.set_processing_instructions(xmldoc, dic)
-            xml_output = xmldoc.toprettyxml()
-
+            xmldoc.toprettyxml()
 
     def set_processing_instructions(self, minidom_object, dic):
@@ -243,5 +233,4 @@
             minidom_object.insertBefore(pi, xmlroot)
         return minidom_object
-
 
     def get_processing_instructions(self, xml_reader_object):
