[Python-checkins] r54460 - python/trunk/Lib/test/test_urllib.py

neal.norwitz python-checkins at python.org
Tue Mar 20 07:13:29 CET 2007


Author: neal.norwitz
Date: Tue Mar 20 07:13:25 2007
New Revision: 54460
Modified:
 python/trunk/Lib/test/test_urllib.py
Log:
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
Modified: python/trunk/Lib/test/test_urllib.py
==============================================================================
--- python/trunk/Lib/test/test_urllib.py	(original)
+++ python/trunk/Lib/test/test_urllib.py	Tue Mar 20 07:13:25 2007
@@ -27,6 +27,7 @@
 def setUp(self):
 """Setup of a temp file to use for testing"""
 self.text = "test_urllib: %s\n" % self.__class__.__name__
+ test_support.unlink(test_support.TESTFN)
 FILE = file(test_support.TESTFN, 'wb')
 try:
 FILE.write(self.text)
@@ -195,6 +196,7 @@
 def test_copy(self):
 # Test that setting the filename argument works.
 second_temp = "%s.2" % test_support.TESTFN
+ test_support.unlink(second_temp)
 self.registerFileForCleanUp(second_temp)
 result = urllib.urlretrieve(self.constructLocalFileUrl(
 test_support.TESTFN), second_temp)
@@ -219,6 +221,7 @@
 self.assertEqual(count, count_holder[0])
 count_holder[0] = count_holder[0] + 1
 second_temp = "%s.2" % test_support.TESTFN
+ test_support.unlink(second_temp)
 self.registerFileForCleanUp(second_temp)
 urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN),
 second_temp, hooktester)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /