Commits

Gael Pasgrimaud  committed a785363

fix #35

  • Participants
  • Parent commits a1048e1

Comments (0)

Files changed (2)

File pyquery/test.py

 
     def __init__(self, *args, **kwargs):
         parser = doctest.DocTestParser()
-        doc = open(self.path).read()
+        fd = open(self.path)
+        doc = fd.read()
+        fd.close()
         test = parser.get_doctest(doc, globals(), '', self.path, 0)
         doctest.DocFileCase.__init__(self, test, optionflags=doctest.ELLIPSIS)
 
     for name in names:
         filename = name + '.txt'
         if os.path.isfile(filename):
-            value = open(name + '.txt').read()
+            fd = open(name + '.txt')
+            value = fd.read()
+            fd.close()
         else:
             value = ''
         values[name] = value