fix: Add back in dummy locales for unit test. (#28938)

Clear old files before regenerating them.
This commit is contained in:
Diana Huang
2021-10-05 13:52:27 -04:00
committed by GitHub
parent 1fc33070c3
commit 849dd693cf

View File

@@ -77,9 +77,20 @@ class TestGenerate(TestCase):
.mo files should exist, and be recently created (modified
after start of test suite)
"""
# Change dummy_locales to only contain Esperanto.
self.configuration.dummy_locales = ['eo']
# Clear previous files.
for locale in self.configuration.dummy_locales:
for filename in ('django', 'djangojs'):
mofile = filename + '.mo'
path = os.path.join(self.configuration.get_messages_dir(locale), mofile)
if os.path.exists(path):
os.remove(path)
# Regenerate files.
generate.main(verbosity=0, strict=False)
for locale in self.configuration.translated_locales:
for locale in self.configuration.dummy_locales:
for filename in ('django', 'djangojs'):
mofile = filename + '.mo'
path = os.path.join(self.configuration.get_messages_dir(locale), mofile)