Fixed ResourceWarning in test_client.tests.ClientTest.test_uploading_named_temp_file().
This commit is contained in:
parent
fff4870bfa
commit
27e156fa31
|
@ -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')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue