25
25
26
26
LOCALE = 'de'
27
27
has_xgettext = find_command ('xgettext' )
28
+ this_directory = os .path .dirname (upath (__file__ ))
28
29
29
30
30
31
@skipUnless (has_xgettext , 'xgettext is mandatory for extraction tests' )
31
32
class ExtractorTests (SimpleTestCase ):
32
33
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' ))
34
35
35
36
PO_FILE = 'locale/%s/LC_MESSAGES/django.po' % LOCALE
36
37
@@ -378,6 +379,17 @@ def test_ignore_option(self):
378
379
self .assertNotMsgId ('This should be ignored.' , po_contents )
379
380
self .assertNotMsgId ('This should be ignored too.' , po_contents )
380
381
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
+
381
393
382
394
class SymlinkExtractorTests (ExtractorTests ):
383
395
@@ -550,7 +562,7 @@ class ExcludedLocaleExtractionTests(ExtractorTests):
550
562
LOCALES = ['en' , 'fr' , 'it' ]
551
563
PO_FILE = 'locale/%s/LC_MESSAGES/django.po'
552
564
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' ))
554
566
555
567
def _set_times_for_all_po_files (self ):
556
568
"""
@@ -608,7 +620,7 @@ class CustomLayoutExtractionTests(ExtractorTests):
608
620
609
621
def setUp (self ):
610
622
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' )
612
624
613
625
def test_no_locale_raises (self ):
614
626
os .chdir (self .test_dir )
@@ -618,7 +630,7 @@ def test_no_locale_raises(self):
618
630
619
631
@override_settings (
620
632
LOCALE_PATHS = (os .path .join (
621
- os . path . dirname ( upath ( __file__ )) , 'project_dir' , 'project_locale' ),)
633
+ this_directory , 'project_dir' , 'project_locale' ),)
622
634
)
623
635
def test_project_locale_paths (self ):
624
636
"""
0 commit comments