2525
2626LOCALE = 'de'
2727has_xgettext = find_command ('xgettext' )
28+ this_directory = os .path .dirname (upath (__file__ ))
2829
2930
3031@skipUnless (has_xgettext , 'xgettext is mandatory for extraction tests' )
3132class ExtractorTests (SimpleTestCase ):
3233
33- test_dir = os .path .abspath (os .path .join (os . path . dirname ( upath ( __file__ )) , 'commands' ))
34+ test_dir = os .path .abspath (os .path .join (this_directory , 'commands' ))
3435
3536 PO_FILE = 'locale/%s/LC_MESSAGES/django.po' % LOCALE
3637
@@ -378,6 +379,17 @@ def test_ignore_option(self):
378379 self .assertNotMsgId ('This should be ignored.' , po_contents )
379380 self .assertNotMsgId ('This should be ignored too.' , po_contents )
380381
382+ @override_settings (
383+ STATIC_ROOT = os .path .join (this_directory , 'commands' , 'static_root/' ),
384+ MEDIA_ROOT = os .path .join (this_directory , 'commands' , 'media_root/' ))
385+ def test_media_static_dirs_ignored (self ):
386+ os .chdir (self .test_dir )
387+ stdout = StringIO ()
388+ management .call_command ('makemessages' , locale = [LOCALE ], verbosity = 2 , stdout = stdout )
389+ data = stdout .getvalue ()
390+ self .assertIn ("ignoring directory static_root" , data )
391+ self .assertIn ("ignoring directory media_root" , data )
392+
381393
382394class SymlinkExtractorTests (ExtractorTests ):
383395
@@ -550,7 +562,7 @@ class ExcludedLocaleExtractionTests(ExtractorTests):
550562 LOCALES = ['en' , 'fr' , 'it' ]
551563 PO_FILE = 'locale/%s/LC_MESSAGES/django.po'
552564
553- test_dir = os .path .abspath (os .path .join (os . path . dirname ( upath ( __file__ )) , 'exclude' ))
565+ test_dir = os .path .abspath (os .path .join (this_directory , 'exclude' ))
554566
555567 def _set_times_for_all_po_files (self ):
556568 """
@@ -608,7 +620,7 @@ class CustomLayoutExtractionTests(ExtractorTests):
608620
609621 def setUp (self ):
610622 self ._cwd = os .getcwd ()
611- self .test_dir = os .path .join (os . path . dirname ( upath ( __file__ )) , 'project_dir' )
623+ self .test_dir = os .path .join (this_directory , 'project_dir' )
612624
613625 def test_no_locale_raises (self ):
614626 os .chdir (self .test_dir )
@@ -618,7 +630,7 @@ def test_no_locale_raises(self):
618630
619631 @override_settings (
620632 LOCALE_PATHS = (os .path .join (
621- os . path . dirname ( upath ( __file__ )) , 'project_dir' , 'project_locale' ),)
633+ this_directory , 'project_dir' , 'project_locale' ),)
622634 )
623635 def test_project_locale_paths (self ):
624636 """
0 commit comments