mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Consolidated i18n commands test with the rest of the i18n tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
35
tests/regressiontests/i18n/commands/compilation.py
Normal file
35
tests/regressiontests/i18n/commands/compilation.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.core.management import CommandError
|
||||
from django.core.management.commands.compilemessages import compile_messages
|
||||
from django.test import TestCase
|
||||
|
||||
LOCALE='es_AR'
|
||||
|
||||
|
||||
class MessageCompilationTests(TestCase):
|
||||
|
||||
MO_FILE='locale/%s/LC_MESSAGES/django.mo' % LOCALE
|
||||
|
||||
def setUp(self):
|
||||
self._cwd = os.getcwd()
|
||||
self.test_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
def tearDown(self):
|
||||
os.chdir(self._cwd)
|
||||
|
||||
|
||||
class PoFileTests(MessageCompilationTests):
|
||||
|
||||
def test_bom_rejection(self):
|
||||
os.chdir(self.test_dir)
|
||||
# We don't use the django.core.management intrastructure (call_command()
|
||||
# et al) because CommandError's cause exit(1) there. We test the
|
||||
# underlying compile_messages function instead
|
||||
out = StringIO()
|
||||
self.assertRaises(CommandError, compile_messages, out, locale=LOCALE)
|
||||
self.failIf(os.path.exists(self.MO_FILE))
|
||||
Reference in New Issue
Block a user