]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
One last unclosed file. 14/head
authorAlex Morega <alex@grep.ro>
Fri, 5 Jul 2013 14:18:45 +0000 (16:18 +0200)
committerAlex Morega <alex@grep.ro>
Fri, 5 Jul 2013 14:20:41 +0000 (16:20 +0200)
Hiding it by calling `file` instead of `open`. Clever!

babel/tests/support.py

index 00b8f18f05f2fc83de7c6a4b2490f23487b8851c..f2e4796ff762a3beaff24c2e8836759be509f836 100644 (file)
@@ -173,7 +173,8 @@ class TranslationsTestCase(unittest.TestCase):
             os.makedirs(messages_dir)
             catalog = Catalog(locale='fr', domain='messages')
             catalog.add('foo', 'bar')
-            write_mo(file(os.path.join(messages_dir, 'messages.mo'), 'wb'), catalog)
+            with open(os.path.join(messages_dir, 'messages.mo'), 'wb') as f:
+                write_mo(f, catalog)
 
             translations = support.Translations.load(tempdir, locales=('fr',), domain='messages')
             self.assertEqual('bar', translations.gettext('foo'))