diff options
| author | Julien Phalip <jphalip@gmail.com> | 2011-12-21 15:35:58 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2011-12-21 15:35:58 +0000 |
| commit | 45e3dff5ac697f16829697bc2a899eaeac8986ea (patch) | |
| tree | 4ec581efd5e97756f6162a0de04a74a3950ac7ce /tests/regressiontests | |
| parent | 39109b0e44c77d0acf1c48c9f48e3631eff5f122 (diff) | |
Ensured that `makemessages` doesn't leave any temporary file over if the parsing of a template file fails. Refs #8536.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index 6566ef4808..b1fc0025c7 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -108,16 +108,14 @@ class BasicExtractorTests(ExtractorTests): os.chdir(self.test_dir) shutil.copyfile('./templates/template_with_error.tpl', './templates/template_with_error.html') self.assertRaises(SyntaxError, management.call_command, 'makemessages', locale=LOCALE, verbosity=0) - try: + with self.assertRaises(SyntaxError) as context_manager: management.call_command('makemessages', locale=LOCALE, verbosity=0) - except SyntaxError, e: - self.assertRegexpMatches( - str(e), + self.assertRegexpMatches(str(context_manager.exception), r'Translation blocks must not include other block tags: blocktrans \(file templates[/\\]template_with_error\.html, line 3\)' ) - finally: - os.remove('./templates/template_with_error.html') - os.remove('./templates/template_with_error.html.py') # Waiting for #8536 to be fixed + os.remove('./templates/template_with_error.html') + # Check that the temporary file was cleaned up + self.assertFalse(os.path.exists('./templates/template_with_error.html.py')) def test_template_message_context_extractor(self): """ |
