From 960e4267f493c4411ab9f5bbdbb774e72fc2423c Mon Sep 17 00:00:00 2001 From: Alex Morega Date: Fri, 5 Jul 2013 16:18:45 +0200 Subject: [PATCH] One last unclosed file. Hiding it by calling `file` instead of `open`. Clever! --- babel/tests/support.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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')) -- 2.47.2