From: Alex Morega Date: Fri, 5 Jul 2013 14:18:45 +0000 (+0200) Subject: One last unclosed file. X-Git-Tag: 1.0~116^2~1^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14%2Fhead;p=thirdparty%2Fbabel.git One last unclosed file. Hiding it by calling `file` instead of `open`. Clever! --- diff --git a/babel/tests/support.py b/babel/tests/support.py index 00b8f18f..f2e4796f 100644 --- a/babel/tests/support.py +++ b/babel/tests/support.py @@ -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'))