mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	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 :-)
This commit is contained in:
		
							parent
							
								
									c990f6454f
								
							
						
					
					
						commit
						ce2ab351f0
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		|  | @ -27,6 +27,7 @@ class urlopen_FileTests(unittest.TestCase): | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         """Setup of a temp file to use for testing""" |         """Setup of a temp file to use for testing""" | ||||||
|         self.text = "test_urllib: %s\n" % self.__class__.__name__ |         self.text = "test_urllib: %s\n" % self.__class__.__name__ | ||||||
|  |         test_support.unlink(test_support.TESTFN) | ||||||
|         FILE = file(test_support.TESTFN, 'wb') |         FILE = file(test_support.TESTFN, 'wb') | ||||||
|         try: |         try: | ||||||
|             FILE.write(self.text) |             FILE.write(self.text) | ||||||
|  | @ -195,6 +196,7 @@ def test_basic(self): | ||||||
|     def test_copy(self): |     def test_copy(self): | ||||||
|         # Test that setting the filename argument works. |         # Test that setting the filename argument works. | ||||||
|         second_temp = "%s.2" % test_support.TESTFN |         second_temp = "%s.2" % test_support.TESTFN | ||||||
|  |         test_support.unlink(second_temp) | ||||||
|         self.registerFileForCleanUp(second_temp) |         self.registerFileForCleanUp(second_temp) | ||||||
|         result = urllib.urlretrieve(self.constructLocalFileUrl( |         result = urllib.urlretrieve(self.constructLocalFileUrl( | ||||||
|             test_support.TESTFN), second_temp) |             test_support.TESTFN), second_temp) | ||||||
|  | @ -219,6 +221,7 @@ def hooktester(count, block_size, total_size, count_holder=[0]): | ||||||
|             self.assertEqual(count, count_holder[0]) |             self.assertEqual(count, count_holder[0]) | ||||||
|             count_holder[0] = count_holder[0] + 1 |             count_holder[0] = count_holder[0] + 1 | ||||||
|         second_temp = "%s.2" % test_support.TESTFN |         second_temp = "%s.2" % test_support.TESTFN | ||||||
|  |         test_support.unlink(second_temp) | ||||||
|         self.registerFileForCleanUp(second_temp) |         self.registerFileForCleanUp(second_temp) | ||||||
|         urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), |         urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), | ||||||
|             second_temp, hooktester) |             second_temp, hooktester) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neal Norwitz
						Neal Norwitz