From 12e01e905b4b09d7dd71e5d0dcf147c16f7f109e Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Sat, 23 Apr 2016 12:44:18 -0700 Subject: [PATCH] Skipping IAM system tests when running in emulator. --- system_tests/pubsub.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system_tests/pubsub.py b/system_tests/pubsub.py index 9f6ababdc7a5..b936c0b154fd 100644 --- a/system_tests/pubsub.py +++ b/system_tests/pubsub.py @@ -171,7 +171,16 @@ def _by_timestamp(message): self.assertEqual(message2.data, MESSAGE_2) self.assertEqual(message2.attributes['extra'], EXTRA_2) + def _maybe_emulator_skip(self): + # NOTE: We check at run-time rather than using the @unittest2.skipIf + # decorator. This matches the philosophy behind using + # setUpModule to determine the environment at run-time + # rather than at import time. + if os.getenv(PUBSUB_EMULATOR) is not None: + self.skipTest('IAM not supported by Pub/Sub emulator') + def test_topic_iam_policy(self): + self._maybe_emulator_skip() topic_name = 'test-topic-iam-policy-topic' + unique_resource_id('-') topic = Config.CLIENT.topic(topic_name) topic.create() @@ -187,6 +196,7 @@ def test_topic_iam_policy(self): self.assertEqual(new_policy.viewers, policy.viewers) def test_subscription_iam_policy(self): + self._maybe_emulator_skip() topic_name = 'test-sub-iam-policy-topic' + unique_resource_id('-') topic = Config.CLIENT.topic(topic_name) topic.create()