Fixes unit test test_period_in_timeperiod_archive (TestArticlesGenerator)

On systems with a none english default locale this test failed because the
period is a tuple of year and month name and the month name depends on the
locale.
This commit is contained in:
Bernhard Scheirle 2016-09-25 10:31:56 +02:00
commit 577b748f5f

View file

@ -297,6 +297,8 @@ class TestArticlesGenerator(unittest.TestCase):
Test that the context of a generated period_archive is passed
'period' : a tuple of year, month, day according to the time period
"""
old_locale = locale.setlocale(locale.LC_ALL)
locale.setlocale(locale.LC_ALL, str('C'))
settings = get_settings(filenames={})
settings['YEAR_ARCHIVE_SAVE_AS'] = 'posts/{date:%Y}/index.html'
@ -357,6 +359,7 @@ class TestArticlesGenerator(unittest.TestCase):
generator.get_template("period_archives"),
settings,
blog=True, dates=dates)
locale.setlocale(locale.LC_ALL, old_locale)
def test_nonexistent_template(self):
"""Attempt to load a non-existent template"""