mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed ResourceWarning in test_client.tests.ClientTest.test_uploading_named_temp_file().
This commit is contained in:
		| @@ -894,8 +894,11 @@ class ClientTest(TestCase): | ||||
|         self.assertEqual(response.content, b'temp_file') | ||||
|  | ||||
|     def test_uploading_named_temp_file(self): | ||||
|         test_file = tempfile.NamedTemporaryFile() | ||||
|         response = self.client.post('/upload_view/', data={'named_temp_file': test_file}) | ||||
|         with tempfile.NamedTemporaryFile() as test_file: | ||||
|             response = self.client.post( | ||||
|                 '/upload_view/', | ||||
|                 data={'named_temp_file': test_file}, | ||||
|             ) | ||||
|         self.assertEqual(response.content, b'named_temp_file') | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user