Skip to content

Commit 2e1e9f6

Browse files
committed
Fix UTC timezone test case if pytz not available; add tests
UTC is a special known timezone so it doesn't raise an exception even if pytz is missing. Added test case with bogus timezone that raises exception. Added testcase for EST that is known with and without pytz.
1 parent 9312d8c commit 2e1e9f6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/test_config.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,23 @@ def testTimeZone(self):
112112
config._get_option('TIMEZONE').set("UTC"))
113113
self.assertEqual(None,
114114
config._get_option('TIMEZONE').set("America/New_York"))
115+
self.assertEqual(None,
116+
config._get_option('TIMEZONE').set("EST"))
117+
self.assertRaises(configuration.OptionValueError,
118+
config._get_option('TIMEZONE').set, "Zool/Zot")
115119

116120
except ImportError:
117-
self.assertRaises(configuration.OptionValueError,
118-
config._get_option('TIMEZONE').set, "UTC")
121+
# UTC is a known offset of 0 coded into roundup.date
122+
# so it works even without pytz.
123+
self.assertEqual(None,
124+
config._get_option('TIMEZONE').set("UTC"))
125+
# same with EST known timeone offset of 5
126+
self.assertEqual(None,
127+
config._get_option('TIMEZONE').set("EST"))
119128
self.assertRaises(configuration.OptionValueError,
120129
config._get_option('TIMEZONE').set, "America/New_York")
121130

131+
122132
def testWebSecretKey(self):
123133
config = configuration.CoreConfig()
124134

0 commit comments

Comments
 (0)