-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow unit tests to pass if pytz is installed. #1706
Conversation
Thanks for the patch! ISTM that a better fix for the test would be to have it try to import def test_module_property(self):
from gcloud import _helpers as MUT
klass = self._getTargetClass()
try:
import pytz
except ImportError:
self.assertTrue(isinstance(MUT.UTC, klass))
else:
self.assertTrue(MUT.UTC is pytz.UTC) |
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.
Done. PTAL. |
Thanks very much! |
Why do we no cover both branches? |
Only one is executed in any given test environment. Did I understand your On Fri, Apr 8, 2016 at 11:48 AM, Danny Hermes notifications@github.com
|
But the relevant coverage environment, i.e. the one that get's reported on our repo (from coveralls.io) use the |
I guess the idea is that the test code will do the right thing in any On Fri, Apr 8, 2016 at 11:55 AM, Danny Hermes notifications@github.com
|
Thanks for sending the PR! |
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.