From 9d34f81dc1fdd3c9c4634b81cf1cb2a3470549f9 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 2 Oct 2019 14:25:28 -0700 Subject: [PATCH 1/4] tests: rewrite logic for skipping VPCSC runs --- monitoring/noxfile.py | 69 ++++---- monitoring/synth.py | 2 +- monitoring/tests/system/test_vpcsc.py | 232 ++++++++------------------ 3 files changed, 100 insertions(+), 203 deletions(-) diff --git a/monitoring/noxfile.py b/monitoring/noxfile.py index 63a11673d3eb..1f4eef8b1aa7 100644 --- a/monitoring/noxfile.py +++ b/monitoring/noxfile.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Generated by synthtool. DO NOT EDIT! + from __future__ import absolute_import import os import shutil @@ -22,6 +24,12 @@ LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core")) +BLACK_VERSION = "black==19.3b0" +BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] + +if os.path.exists("samples"): + BLACK_PATHS.append("samples") + @nox.session(python="3.7") def lint(session): @@ -30,14 +38,8 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", "black", *LOCAL_DEPS) - session.run( - "black", - "--check", - "google", - "tests", - "docs", - ) + session.install("flake8", BLACK_VERSION, *LOCAL_DEPS) + session.run("black", "--check", *BLACK_PATHS) session.run("flake8", "google", "tests") @@ -46,18 +48,13 @@ def blacken(session): """Run black. Format code to uniform standard. - + This currently uses Python 3.6 due to the automated Kokoro run of synthtool. That run uses an image that doesn't have 3.6 installed. Before updating this check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ - session.install("black") - session.run( - "black", - "google", - "tests", - "docs", - ) + session.install(BLACK_VERSION) + session.run("black", *BLACK_PATHS) @nox.session(python="3.7") @@ -83,7 +80,7 @@ def default(session): "--cov-append", "--cov-config=.coveragerc", "--cov-report=", - "--cov-fail-under=97", + "--cov-fail-under=0", os.path.join("tests", "unit"), *session.posargs, ) @@ -121,20 +118,11 @@ def system(session): session.install("-e", "../test_utils/") session.install("-e", ".") - # Additional setup for VPCSC system tests - if os.environ.get("GOOGLE_CLOUD_TESTS_IN_VPCSC") != "true": - # Unset PROJECT_ID, since VPCSC system tests expect this to be a project - # within the VPCSC perimeter. - env = { - "PROJECT_ID": "", - "GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT": os.environ.get("PROJECT_ID"), - } - # Run py.test against the system tests. if system_test_exists: - session.run("py.test", "--quiet", system_test_path, env=env, *session.posargs) + session.run("py.test", "--quiet", system_test_path, *session.posargs) if system_test_folder_exists: - session.run("py.test", "--quiet", system_test_folder_path, env=env, *session.posargs) + session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) @nox.session(python="3.7") @@ -149,21 +137,24 @@ def cover(session): session.run("coverage", "erase") + @nox.session(python="3.7") def docs(session): """Build the docs for this library.""" - session.install('-e', '.') - session.install('sphinx', 'alabaster', 'recommonmark') + session.install("-e", ".") + session.install("sphinx", "alabaster", "recommonmark") - shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( - 'sphinx-build', - '-W', # warnings as errors - '-T', # show full traceback on exception - '-N', # no colors - '-b', 'html', - '-d', os.path.join('docs', '_build', 'doctrees', ''), - os.path.join('docs', ''), - os.path.join('docs', '_build', 'html', ''), + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), ) diff --git a/monitoring/synth.py b/monitoring/synth.py index 447958ceeb89..8dedfedd466e 100644 --- a/monitoring/synth.py +++ b/monitoring/synth.py @@ -94,6 +94,6 @@ # Add templated files # ---------------------------------------------------------------------------- templated_files = common.py_library(unit_cov_level=97, cov_level=97) -s.move(templated_files, excludes=["noxfile.py"]) +s.move(templated_files) s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/monitoring/tests/system/test_vpcsc.py b/monitoring/tests/system/test_vpcsc.py index ffc78cbfc047..a248eaf91b7e 100644 --- a/monitoring/tests/system/test_vpcsc.py +++ b/monitoring/tests/system/test_vpcsc.py @@ -27,13 +27,12 @@ from google.cloud import monitoring_v3 from google.cloud.monitoring_v3 import enums -PROJECT_INSIDE = os.environ.get("PROJECT_ID", None) -if not PROJECT_INSIDE: - PROJECT_INSIDE = None -PROJECT_OUTSIDE = os.environ.get( - "GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", None -) -IS_INSIDE_VPCSC = os.environ.get("GOOGLE_CLOUD_TESTS_IN_VPCSC", "false") +IS_INSIDE_VPCSC = "GOOGLE_CLOUD_TESTS_IN_VPCSC" in os.environ + +# If IS_INSIDE_VPCSC is set, these environment variables should also be set +if IS_INSIDE_VPCSC: + PROJECT_INSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_INSIDE_PERIMETER_PROJECT"] + PROJECT_OUTSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT"] class TestVPCServiceControlV3(object): @@ -54,7 +53,7 @@ def _is_rejected(call): @staticmethod def _do_test(delayed_inside, delayed_outside): - if IS_INSIDE_VPCSC.lower() == "true": + if IS_INSIDE_VPCSC: assert TestVPCServiceControlV3._is_rejected(delayed_outside) assert not (TestVPCServiceControlV3._is_rejected(delayed_inside)) else: @@ -62,11 +61,8 @@ def _do_test(delayed_inside, delayed_outside): assert TestVPCServiceControlV3._is_rejected(delayed_inside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -77,11 +73,8 @@ def test_create_alert_policy(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_delete_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -92,11 +85,8 @@ def test_delete_alert_policy(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -107,11 +97,8 @@ def test_get_alert_policy(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_alert_policies(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -122,11 +109,8 @@ def test_list_alert_policies(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_update_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -137,11 +121,8 @@ def test_update_alert_policy(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_group(self): client = monitoring_v3.GroupServiceClient() @@ -152,11 +133,8 @@ def test_create_group(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_delete_group(self): client = monitoring_v3.GroupServiceClient() @@ -167,11 +145,8 @@ def test_delete_group(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_group(self): client = monitoring_v3.GroupServiceClient() @@ -182,11 +157,8 @@ def test_get_group(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_group_members(self): client = monitoring_v3.GroupServiceClient() @@ -197,11 +169,8 @@ def test_list_group_members(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_groups(self): client = monitoring_v3.GroupServiceClient() @@ -212,11 +181,8 @@ def test_list_groups(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_update_group(self): client = monitoring_v3.GroupServiceClient() @@ -227,11 +193,8 @@ def test_update_group(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -242,11 +205,8 @@ def test_create_metric_descriptor(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_time_series(self): client = monitoring_v3.MetricServiceClient() @@ -257,11 +217,8 @@ def test_create_time_series(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_delete_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -276,11 +233,8 @@ def test_delete_metric_descriptor(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -295,11 +249,8 @@ def test_get_metric_descriptor(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_monitored_resource_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -314,11 +265,8 @@ def test_get_monitored_resource_descriptor(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_metric_descriptors(self): client = monitoring_v3.MetricServiceClient() @@ -329,11 +277,8 @@ def test_list_metric_descriptors(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_monitored_resource_descriptors(self): client = monitoring_v3.MetricServiceClient() @@ -346,11 +291,8 @@ def test_list_monitored_resource_descriptors(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_time_series(self): client = monitoring_v3.MetricServiceClient() @@ -365,11 +307,8 @@ def test_list_time_series(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -380,11 +319,8 @@ def test_create_notification_channel(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_delete_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -399,11 +335,8 @@ def test_delete_notification_channel(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -418,11 +351,8 @@ def test_get_notification_channel(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_notification_channel_descriptor(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -439,11 +369,8 @@ def test_get_notification_channel_descriptor(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_notification_channel_descriptors(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -458,11 +385,8 @@ def test_list_notification_channel_descriptors(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_notification_channels(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -473,11 +397,8 @@ def test_list_notification_channels(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_update_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -496,11 +417,8 @@ def test_update_notification_channel(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_create_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -511,11 +429,8 @@ def test_create_uptime_check_config(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_delete_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -530,11 +445,8 @@ def test_delete_uptime_check_config(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_get_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -549,11 +461,8 @@ def test_get_uptime_check_config(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_list_uptime_check_configs(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -564,11 +473,8 @@ def test_list_uptime_check_configs(self): TestVPCServiceControlV3._do_test(delayed_inside, delayed_outside) @pytest.mark.skipif( - PROJECT_INSIDE is None, reason="Missing environment variable: PROJECT_ID" - ) - @pytest.mark.skipif( - PROJECT_OUTSIDE is None, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", + not IS_INSIDE_VPCSC, + reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", ) def test_update_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() From 9f9742821ec1b1a07b90b0550814071e913e689c Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 2 Oct 2019 14:55:58 -0700 Subject: [PATCH 2/4] tests: remove unused conditional --- monitoring/setup.py | 64 +++++++++++++-------------- monitoring/tests/system/test_vpcsc.py | 8 +--- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/monitoring/setup.py b/monitoring/setup.py index 33b8b97f4f63..6554be9931f6 100644 --- a/monitoring/setup.py +++ b/monitoring/setup.py @@ -20,40 +20,36 @@ # Package metadata. -name = 'google-cloud-monitoring' -description = 'Stackdriver Monitoring API client library' -version = '0.33.0' +name = "google-cloud-monitoring" +description = "Stackdriver Monitoring API client library" +version = "0.33.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' -release_status = 'Development Status :: 3 - Alpha' -dependencies = [ - 'google-api-core[grpc] >= 1.14.0, < 2.0.0dev', -] -extras = { - 'pandas': 'pandas >= 0.17.1', -} +release_status = "Development Status :: 3 - Alpha" +dependencies = ["google-api-core[grpc] >= 1.14.0, < 2.0.0dev"] +extras = {"pandas": "pandas >= 0.17.1"} # Setup boilerplate below this line. package_root = os.path.abspath(os.path.dirname(__file__)) -readme_filename = os.path.join(package_root, 'README.rst') -with io.open(readme_filename, encoding='utf-8') as readme_file: +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [ - package for package in setuptools.find_packages() - if package.startswith('google')] + package for package in setuptools.find_packages() if package.startswith("google") +] # Determine which namespaces are needed. -namespaces = ['google'] -if 'google.cloud' in packages: - namespaces.append('google.cloud') +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") setuptools.setup( @@ -61,30 +57,30 @@ version=version, description=description, long_description=readme, - author='Google LLC', - author_email='googleapis-packages@google.com', - license='Apache 2.0', - url='https://github.com/GoogleCloudPlatform/google-cloud-python', + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url="https://github.com/GoogleCloudPlatform/google-cloud-python", classifiers=[ release_status, - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Operating System :: OS Independent', - 'Topic :: Internet', + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Operating System :: OS Independent", + "Topic :: Internet", ], - platforms='Posix; MacOS X; Windows', + platforms="Posix; MacOS X; Windows", packages=packages, namespace_packages=namespaces, install_requires=dependencies, extras_require=extras, - python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', + python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", include_package_data=True, zip_safe=False, ) diff --git a/monitoring/tests/system/test_vpcsc.py b/monitoring/tests/system/test_vpcsc.py index a248eaf91b7e..fa2cd670bab6 100644 --- a/monitoring/tests/system/test_vpcsc.py +++ b/monitoring/tests/system/test_vpcsc.py @@ -53,12 +53,8 @@ def _is_rejected(call): @staticmethod def _do_test(delayed_inside, delayed_outside): - if IS_INSIDE_VPCSC: - assert TestVPCServiceControlV3._is_rejected(delayed_outside) - assert not (TestVPCServiceControlV3._is_rejected(delayed_inside)) - else: - assert not (TestVPCServiceControlV3._is_rejected(delayed_outside)) - assert TestVPCServiceControlV3._is_rejected(delayed_inside) + assert TestVPCServiceControlV3._is_rejected(delayed_outside) + assert not (TestVPCServiceControlV3._is_rejected(delayed_inside)) @pytest.mark.skipif( not IS_INSIDE_VPCSC, From d0a934ba3b76a106c1e425687a1426160353137b Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 2 Oct 2019 15:18:51 -0700 Subject: [PATCH 3/4] tests: more adjustments --- monitoring/tests/system/test_vpcsc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monitoring/tests/system/test_vpcsc.py b/monitoring/tests/system/test_vpcsc.py index fa2cd670bab6..c4ffd598c2af 100644 --- a/monitoring/tests/system/test_vpcsc.py +++ b/monitoring/tests/system/test_vpcsc.py @@ -31,10 +31,9 @@ # If IS_INSIDE_VPCSC is set, these environment variables should also be set if IS_INSIDE_VPCSC: - PROJECT_INSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_INSIDE_PERIMETER_PROJECT"] + PROJECT_INSIDE = os.environ["PROJECT_ID"] PROJECT_OUTSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT"] - class TestVPCServiceControlV3(object): @staticmethod def _is_rejected(call): From 9f1d0f6bf818a0dffb34a78d7293a2a6ac63d0af Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 3 Oct 2019 12:29:11 -0700 Subject: [PATCH 4/4] tests: change wording of pytest skip reason --- monitoring/tests/system/test_vpcsc.py | 64 +++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/monitoring/tests/system/test_vpcsc.py b/monitoring/tests/system/test_vpcsc.py index c4ffd598c2af..d85b32fafb9d 100644 --- a/monitoring/tests/system/test_vpcsc.py +++ b/monitoring/tests/system/test_vpcsc.py @@ -34,12 +34,12 @@ PROJECT_INSIDE = os.environ["PROJECT_ID"] PROJECT_OUTSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT"] + class TestVPCServiceControlV3(object): @staticmethod def _is_rejected(call): try: responses = call() - # If we reach this line, then call() did not raise. The return # result must be either a google.api_core.page_iterator.Iterator # instance, or None. @@ -57,7 +57,7 @@ def _do_test(delayed_inside, delayed_outside): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -69,7 +69,7 @@ def test_create_alert_policy(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_delete_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -81,7 +81,7 @@ def test_delete_alert_policy(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -93,7 +93,7 @@ def test_get_alert_policy(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_alert_policies(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -105,7 +105,7 @@ def test_list_alert_policies(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_update_alert_policy(self): client = monitoring_v3.AlertPolicyServiceClient() @@ -117,7 +117,7 @@ def test_update_alert_policy(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_group(self): client = monitoring_v3.GroupServiceClient() @@ -129,7 +129,7 @@ def test_create_group(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_delete_group(self): client = monitoring_v3.GroupServiceClient() @@ -141,7 +141,7 @@ def test_delete_group(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_group(self): client = monitoring_v3.GroupServiceClient() @@ -153,7 +153,7 @@ def test_get_group(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_group_members(self): client = monitoring_v3.GroupServiceClient() @@ -165,7 +165,7 @@ def test_list_group_members(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_groups(self): client = monitoring_v3.GroupServiceClient() @@ -177,7 +177,7 @@ def test_list_groups(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_update_group(self): client = monitoring_v3.GroupServiceClient() @@ -189,7 +189,7 @@ def test_update_group(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -201,7 +201,7 @@ def test_create_metric_descriptor(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_time_series(self): client = monitoring_v3.MetricServiceClient() @@ -213,7 +213,7 @@ def test_create_time_series(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_delete_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -229,7 +229,7 @@ def test_delete_metric_descriptor(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_metric_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -245,7 +245,7 @@ def test_get_metric_descriptor(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_monitored_resource_descriptor(self): client = monitoring_v3.MetricServiceClient() @@ -261,7 +261,7 @@ def test_get_monitored_resource_descriptor(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_metric_descriptors(self): client = monitoring_v3.MetricServiceClient() @@ -273,7 +273,7 @@ def test_list_metric_descriptors(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_monitored_resource_descriptors(self): client = monitoring_v3.MetricServiceClient() @@ -287,7 +287,7 @@ def test_list_monitored_resource_descriptors(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_time_series(self): client = monitoring_v3.MetricServiceClient() @@ -303,7 +303,7 @@ def test_list_time_series(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -315,7 +315,7 @@ def test_create_notification_channel(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_delete_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -331,7 +331,7 @@ def test_delete_notification_channel(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -347,7 +347,7 @@ def test_get_notification_channel(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_notification_channel_descriptor(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -365,7 +365,7 @@ def test_get_notification_channel_descriptor(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_notification_channel_descriptors(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -381,7 +381,7 @@ def test_list_notification_channel_descriptors(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_notification_channels(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -393,7 +393,7 @@ def test_list_notification_channels(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_update_notification_channel(self): client = monitoring_v3.NotificationChannelServiceClient() @@ -413,7 +413,7 @@ def test_update_notification_channel(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_create_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -425,7 +425,7 @@ def test_create_uptime_check_config(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_delete_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -441,7 +441,7 @@ def test_delete_uptime_check_config(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_get_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -457,7 +457,7 @@ def test_get_uptime_check_config(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_list_uptime_check_configs(self): client = monitoring_v3.UptimeCheckServiceClient() @@ -469,7 +469,7 @@ def test_list_uptime_check_configs(self): @pytest.mark.skipif( not IS_INSIDE_VPCSC, - reason="Missing environment variable: GOOGLE_CLOUD_TESTS_IN_VPCSC", + reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True", ) def test_update_uptime_check_config(self): client = monitoring_v3.UptimeCheckServiceClient()