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:43:50 +0200 |
| commit | d6f293ad1b5179f027e2c62ba8e79612f0076b8a (patch) | |
| tree | 068d49a814766dab5f26a8f1e5701d23b89a020f /tests | |
| parent | 01515ebaa45a7facc6b450f3fea77dcdbec85887 (diff) | |
[1.7.x] 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.
Backport of 28efafa24c from master.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/test_extraction.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index f0a7b35fae..295388ec5e 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -22,6 +22,7 @@ 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') @@ -31,8 +32,7 @@ class ExtractorTests(SimpleTestCase): def setUp(self): self._cwd = os.getcwd() - self.test_dir = os.path.abspath( - os.path.join(os.path.dirname(upath(__file__)), 'commands')) + self.test_dir = os.path.abspath(os.path.join(this_directory, 'commands')) def _rmrf(self, dname): if os.path.commonprefix([self.test_dir, os.path.abspath(dname)]) != self.test_dir: @@ -361,6 +361,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): @@ -530,7 +541,7 @@ class MultipleLocaleExtractionTests(ExtractorTests): 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) @@ -540,7 +551,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): """ |
