Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions monitoring/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ localdeps =
pip install --quiet --upgrade {toxinidir}/../core
deps =
pytest
mock
covercmd =
py.test --quiet \
--cov=google.cloud.monitoring \
Expand Down
6 changes: 3 additions & 3 deletions monitoring/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ def test_resource_factory(self):

def test_timeseries_factory_gauge(self):
import datetime
from google.cloud._testing import _Monkey
import google.cloud.monitoring.client
import mock
from google.cloud._helpers import _datetime_to_rfc3339
METRIC_TYPE = 'custom.googleapis.com/my_metric'
METRIC_LABELS = {
Expand Down Expand Up @@ -222,7 +221,8 @@ def test_timeseries_factory_gauge(self):
TIME2_STR = _datetime_to_rfc3339(TIME2, ignore_zone=False)
# Construct a time series assuming a gauge metric using the current
# time
with _Monkey(google.cloud.monitoring.client, _UTCNOW=lambda: TIME2):
with mock.patch('google.cloud.monitoring.client._UTCNOW',
new=lambda: TIME2):
timeseries_no_end = client.time_series(metric, resource, VALUE)

self.assertEqual(timeseries_no_end.points[0].end_time, TIME2_STR)
Expand Down
6 changes: 3 additions & 3 deletions monitoring/unit_tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def test_constructor_maximal(self):

def test_constructor_default_end_time(self):
import datetime
from google.cloud._testing import _Monkey
from google.cloud.monitoring import query as MUT
import mock

MINUTES = 5
NOW, T0, T1 = [
Expand All @@ -140,7 +139,8 @@ def test_constructor_default_end_time(self):
]

client = _Client(project=PROJECT, connection=_Connection())
with _Monkey(MUT, _UTCNOW=lambda: NOW):
with mock.patch('google.cloud.monitoring.query._UTCNOW',
new=lambda: NOW):
query = self._make_one(client, METRIC_TYPE, minutes=MINUTES)

self.assertEqual(query._start_time, T0)
Expand Down