summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorRamiro Morales <ramiro@rmorales.net>2013-10-14 15:26:54 -0300
committerRamiro Morales <ramiro@rmorales.net>2013-10-14 15:34:43 -0300
commit8ab5f1fe4750105dae734764baed54bd4d22792b (patch)
tree91ed811d9fc8a2f139a8a321b78902b788ff7024 /tests/files
parent1ac534a92f8cabc209ccabe223344b43bc1b11d8 (diff)
downloaddjango-8ab5f1fe4750105dae734764baed54bd4d22792b.tar.gz
Close file after tests added in 945e033a69.
Avoids failures on Windows. Refs #8918.
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 40aa9f6d75..7d34fdbb16 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -65,6 +65,7 @@ class FileStorageTests(TestCase):
obj2.normal.save("django_test.txt", ContentFile("more content"))
self.assertEqual(obj2.normal.name, "tests/django_test_1.txt")
self.assertEqual(obj2.normal.size, 12)
+ obj2.normal.close()
# Push the objects into the cache to make sure they pickle properly
cache.set("obj1", obj1)
@@ -75,6 +76,7 @@ class FileStorageTests(TestCase):
obj2.delete()
obj2.normal.save("django_test.txt", ContentFile("more content"))
self.assertEqual(obj2.normal.name, "tests/django_test_2.txt")
+ obj2.normal.close()
# Multiple files with the same name get _N appended to them.
objs = [Storage() for i in range(3)]
@@ -105,12 +107,14 @@ class FileStorageTests(TestCase):
obj4 = Storage()
obj4.random.save("random_file", ContentFile("random content"))
self.assertTrue(obj4.random.name.endswith("/random_file"))
+ obj4.random.close()
# upload_to can be empty, meaning it does not use subdirectory.
obj5 = Storage()
obj5.empty.save('django_test.txt', ContentFile('more content'))
self.assertEqual(obj5.empty.name, "./django_test.txt")
self.assertEqual(obj5.empty.read(), b"more content")
+ obj5.empty.close()
def test_file_object(self):
# Create sample file