Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Close file after tests added in 945e033.

Avoids failures on Windows. Refs #8918.
  • Loading branch information...
commit 8ab5f1fe4750105dae734764baed54bd4d22792b 1 parent 1ac534a
Ramiro Morales authored October 14, 2013

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  tests/files/tests.py
4  tests/files/tests.py
@@ -65,6 +65,7 @@ def test_files(self):
65 65
         obj2.normal.save("django_test.txt", ContentFile("more content"))
66 66
         self.assertEqual(obj2.normal.name, "tests/django_test_1.txt")
67 67
         self.assertEqual(obj2.normal.size, 12)
  68
+        obj2.normal.close()
68 69
 
69 70
         # Push the objects into the cache to make sure they pickle properly
70 71
         cache.set("obj1", obj1)
@@ -75,6 +76,7 @@ def test_files(self):
75 76
         obj2.delete()
76 77
         obj2.normal.save("django_test.txt", ContentFile("more content"))
77 78
         self.assertEqual(obj2.normal.name, "tests/django_test_2.txt")
  79
+        obj2.normal.close()
78 80
 
79 81
         # Multiple files with the same name get _N appended to them.
80 82
         objs = [Storage() for i in range(3)]
@@ -105,12 +107,14 @@ def test_files(self):
105 107
         obj4 = Storage()
106 108
         obj4.random.save("random_file", ContentFile("random content"))
107 109
         self.assertTrue(obj4.random.name.endswith("/random_file"))
  110
+        obj4.random.close()
108 111
 
109 112
         # upload_to can be empty, meaning it does not use subdirectory.
110 113
         obj5 = Storage()
111 114
         obj5.empty.save('django_test.txt', ContentFile('more content'))
112 115
         self.assertEqual(obj5.empty.name, "./django_test.txt")
113 116
         self.assertEqual(obj5.empty.read(), b"more content")
  117
+        obj5.empty.close()
114 118
 
115 119
     def test_file_object(self):
116 120
         # Create sample file

0 notes on commit 8ab5f1f

Please sign in to comment.
Something went wrong with that request. Please try again.