From 967e939d9ff6933741b11540585cce43808a179e Mon Sep 17 00:00:00 2001 From: Ken Rimey Date: Fri, 8 Apr 2016 08:14:14 -0400 Subject: [PATCH] Allow unit tests to pass if pytz is installed. I'm assuming the intent of test_module_property() is to check that gcloud._helpers.UTC is defined and has the right sort of value. It was failing if pytz happened to be installed. Note that the current test environment does _not_ install pytz. The gcloud package uses pytz if it is available but does not depend on it. As per a suggestion from @tseaver, we test gcloud._helpers.UTC against pytz.UTC if pytz is available. --- gcloud/test__helpers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcloud/test__helpers.py b/gcloud/test__helpers.py index 00aa5075c731..25943aa96b9e 100644 --- a/gcloud/test__helpers.py +++ b/gcloud/test__helpers.py @@ -54,9 +54,13 @@ def _makeOne(self): def test_module_property(self): from gcloud import _helpers as MUT - klass = self._getTargetClass() - self.assertTrue(isinstance(MUT.UTC, klass)) + try: + import pytz + except ImportError: # pragma: NO COVER + self.assertTrue(isinstance(MUT.UTC, klass)) + else: + self.assertIs(MUT.UTC, pytz.UTC) # pragma: NO COVER def test_dst(self): import datetime