diff options
author | Claude Paroz <claude@2xlibre.net> | 2014-07-15 11:10:50 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2014-07-16 09:38:57 +0200 |
commit | 28efafa24c8304f2553a0d00f90ed05e7e66318c (patch) | |
tree | d394059dcadeccc68fa626c0539e9423e76b25f2 /tests/i18n/test_extraction.py | |
parent | 015496539247b24c73b163f279ae8c8d3ccefc4c (diff) | |
download | django-28efafa24c8304f2553a0d00f90ed05e7e66318c.tar.gz |
Ignored STATIC_ROOT and MEDIA_ROOT in makemessages
Also alleviate issues with weird file names typically found in
MEDIA_ROOT directories (#23010).
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/i18n/test_extraction.py')
-rw-r--r-- | tests/i18n/test_extraction.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index 3e004acb9b..c4cb56e65e 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -25,12 +25,13 @@ from django.utils.translation import TranslatorCommentWarning LOCALE = 'de' has_xgettext = find_command('xgettext') +this_directory = os.path.dirname(upath(__file__)) @skipUnless(has_xgettext, 'xgettext is mandatory for extraction tests') class ExtractorTests(SimpleTestCase): - test_dir = os.path.abspath(os.path.join(os.path.dirname(upath(__file__)), 'commands')) + test_dir = os.path.abspath(os.path.join(this_directory, 'commands')) PO_FILE = 'locale/%s/LC_MESSAGES/django.po' % LOCALE @@ -378,6 +379,17 @@ class IgnoredExtractorTests(ExtractorTests): self.assertNotMsgId('This should be ignored.', po_contents) self.assertNotMsgId('This should be ignored too.', po_contents) + @override_settings( + STATIC_ROOT=os.path.join(this_directory, 'commands', 'static_root/'), + MEDIA_ROOT=os.path.join(this_directory, 'commands', 'media_root/')) + def test_media_static_dirs_ignored(self): + os.chdir(self.test_dir) + stdout = StringIO() + management.call_command('makemessages', locale=[LOCALE], verbosity=2, stdout=stdout) + data = stdout.getvalue() + self.assertIn("ignoring directory static_root", data) + self.assertIn("ignoring directory media_root", data) + class SymlinkExtractorTests(ExtractorTests): @@ -550,7 +562,7 @@ class ExcludedLocaleExtractionTests(ExtractorTests): LOCALES = ['en', 'fr', 'it'] PO_FILE = 'locale/%s/LC_MESSAGES/django.po' - test_dir = os.path.abspath(os.path.join(os.path.dirname(upath(__file__)), 'exclude')) + test_dir = os.path.abspath(os.path.join(this_directory, 'exclude')) def _set_times_for_all_po_files(self): """ @@ -608,7 +620,7 @@ class CustomLayoutExtractionTests(ExtractorTests): def setUp(self): self._cwd = os.getcwd() - self.test_dir = os.path.join(os.path.dirname(upath(__file__)), 'project_dir') + self.test_dir = os.path.join(this_directory, 'project_dir') def test_no_locale_raises(self): os.chdir(self.test_dir) @@ -618,7 +630,7 @@ class CustomLayoutExtractionTests(ExtractorTests): @override_settings( LOCALE_PATHS=(os.path.join( - os.path.dirname(upath(__file__)), 'project_dir', 'project_locale'),) + this_directory, 'project_dir', 'project_locale'),) ) def test_project_locale_paths(self): """ |