|
22 | 22 | from tests._builders import build_scoped_credentials |
23 | 23 |
|
24 | 24 |
|
| 25 | +@mock.patch.dict(os.environ, {"SPANNER_DISABLE_BUILTIN_METRICS": "true"}) |
25 | 26 | class TestClient(unittest.TestCase): |
26 | 27 | PROJECT = "PROJECT" |
27 | 28 | PATH = "projects/%s" % (PROJECT,) |
@@ -161,8 +162,7 @@ def test_constructor_custom_client_info(self): |
161 | 162 | creds = build_scoped_credentials() |
162 | 163 | self._constructor_test_helper(expected_scopes, creds, client_info=client_info) |
163 | 164 |
|
164 | | - # Disable metrics to avoid google.auth.default calls from Metric Exporter |
165 | | - @mock.patch.dict(os.environ, {"SPANNER_ENABLE_BUILTIN_METRICS": ""}) |
| 165 | + # Metrics are disabled by default for tests in this class |
166 | 166 | def test_constructor_implicit_credentials(self): |
167 | 167 | from google.cloud.spanner_v1 import client as MUT |
168 | 168 |
|
@@ -255,8 +255,8 @@ def test_constructor_w_directed_read_options(self): |
255 | 255 | expected_scopes, creds, directed_read_options=self.DIRECTED_READ_OPTIONS |
256 | 256 | ) |
257 | 257 |
|
258 | | - @mock.patch.dict(os.environ, {"SPANNER_ENABLE_BUILTIN_METRICS": "true"}) |
259 | 258 | @mock.patch("google.cloud.spanner_v1.client.SpannerMetricsTracerFactory") |
| 259 | + @mock.patch.dict(os.environ, {"SPANNER_DISABLE_BUILTIN_METRICS": "false"}) |
260 | 260 | def test_constructor_w_metrics_initialization_error( |
261 | 261 | self, mock_spanner_metrics_factory |
262 | 262 | ): |
|
0 commit comments