<s> from os . path import join , normpath , abspath , dirname <EOL> import warnings <EOL> import django <EOL> from django . conf import settings <EOL> from django . test . utils import get_warnings_state , restore_warnings_state <EOL> from django . utils . translation import _trans <EOL> from django . utils . unittest import TestCase <EOL> class DeprecationWarningTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . warning_state = get_warnings_state ( ) <EOL> self . old_settings_module = settings . SETTINGS_MODULE <EOL> settings . SETTINGS_MODULE = '<STR_LIT>' <EOL> self . old_locale_paths = settings . LOCALE_PATHS <EOL> def tearDown ( self ) : <EOL> restore_warnings_state ( self . warning_state ) <EOL> settings . SETTINGS_MODULE = self . old_settings_module <EOL> settings . LOCALE_PATHS = self . old_locale_paths <EOL> def test_warn_if_project_has_locale_subdir ( self ) : <EOL> """<STR_LIT>""" <EOL> project_path = join ( dirname ( abspath ( __file__ ) ) , '<STR_LIT:..>' ) <EOL> warnings . filterwarnings ( '<STR_LIT:error>' , <EOL> "<STR_LIT>" , <EOL> PendingDeprecationWarning ) <EOL> _trans . __dict__ = { } <EOL> self . assertRaises ( PendingDeprecationWarning , django . utils . translation . ugettext , '<STR_LIT>' ) <EOL> def test_no_warn_if_project_and_locale_paths_overlap ( self ) : <EOL> """<STR_LIT>""" <EOL> project_path = join ( dirname ( abspath ( __file__ ) ) , '<STR_LIT:..>' ) <EOL> settings . LOCALE_PATHS += ( normpath ( join ( project_path , '<STR_LIT>' ) ) , ) <EOL> warnings . filterwarnings ( '<STR_LIT:error>' , <EOL> "<STR_LIT>" , <EOL> PendingDeprecationWarning ) <EOL> _trans . __dict__ = { } <EOL> try : <EOL> django . utils . translation . ugettext ( '<STR_LIT>' ) <EOL> except PendingDeprecationWarning : <EOL> self . fail ( "<STR_LIT>" ) </s>
