From 577b748f5f58b0adaee91f4fa66407adaf5bd5f5 Mon Sep 17 00:00:00 2001 From: Bernhard Scheirle Date: Sun, 25 Sep 2016 10:31:56 +0200 Subject: [PATCH] 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. --- pelican/tests/test_generators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py index c9aa1cff..feded3e8 100644 --- a/pelican/tests/test_generators.py +++ b/pelican/tests/test_generators.py @@ -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"""