[Python-checkins] r62266 - python/trunk/Lib/test/test_array.py python/trunk/Lib/test/test_deque.py python/trunk/Lib/test/test_gzip.py python/trunk/Lib/test/test_uu.py

neal.norwitz python-checkins at python.org
Thu Apr 10 07:46:40 CEST 2008


Author: neal.norwitz
Date: Thu Apr 10 07:46:39 2008
New Revision: 62266

Modified:
   python/trunk/Lib/test/test_array.py
   python/trunk/Lib/test/test_deque.py
   python/trunk/Lib/test/test_gzip.py
   python/trunk/Lib/test/test_uu.py
Log:
Remove the test file before writing it in case there is no write permission.
This might help fix some of the failures on Windows box(es).  It doesn't hurt
either way and ensure the tests are a little more self contained (ie have
less assumptions).


Modified: python/trunk/Lib/test/test_array.py
==============================================================================
--- python/trunk/Lib/test/test_array.py	(original)
+++ python/trunk/Lib/test/test_array.py	Thu Apr 10 07:46:39 2008
@@ -163,6 +163,7 @@
         a = array.array(self.typecode, 2*self.example)
         self.assertRaises(TypeError, a.tofile)
         self.assertRaises(TypeError, a.tofile, cStringIO.StringIO())
+        test_support.unlink(test_support.TESTFN)
         f = open(test_support.TESTFN, 'wb')
         try:
             a.tofile(f)

Modified: python/trunk/Lib/test/test_deque.py
==============================================================================
--- python/trunk/Lib/test/test_deque.py	(original)
+++ python/trunk/Lib/test/test_deque.py	Thu Apr 10 07:46:39 2008
@@ -63,6 +63,7 @@
         self.assertEqual(list(d), range(7, 10))
         d = deque(xrange(200), maxlen=10)
         d.append(d)
+        test_support.unlink(test_support.TESTFN)
         fo = open(test_support.TESTFN, "wb")
         try:
             print >> fo, d,
@@ -281,6 +282,7 @@
     def test_print(self):
         d = deque(xrange(200))
         d.append(d)
+        test_support.unlink(test_support.TESTFN)
         fo = open(test_support.TESTFN, "wb")
         try:
             print >> fo, d,

Modified: python/trunk/Lib/test/test_gzip.py
==============================================================================
--- python/trunk/Lib/test/test_gzip.py	(original)
+++ python/trunk/Lib/test/test_gzip.py	Thu Apr 10 07:46:39 2008
@@ -25,13 +25,10 @@
     filename = test_support.TESTFN
 
     def setUp (self):
-        pass
+        test_support.unlink(self.filename)
 
     def tearDown (self):
-        try:
-            os.unlink(self.filename)
-        except os.error:
-            pass
+        test_support.unlink(self.filename)
 
 
     def test_write (self):

Modified: python/trunk/Lib/test/test_uu.py
==============================================================================
--- python/trunk/Lib/test/test_uu.py	(original)
+++ python/trunk/Lib/test/test_uu.py	Thu Apr 10 07:46:39 2008
@@ -114,6 +114,7 @@
     def test_encode(self):
         fin = fout = None
         try:
+            test_support.unlink(self.tmpin)
             fin = open(self.tmpin, 'wb')
             fin.write(plaintext)
             fin.close()
@@ -143,6 +144,7 @@
     def test_decode(self):
         f = None
         try:
+            test_support.unlink(self.tmpin)
             f = open(self.tmpin, 'w')
             f.write(encodedtextwrapped % (0644, self.tmpout))
             f.close()


More information about the Python-checkins mailing list