File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ localdeps =
88deps =
99 {toxinidir}/../core
1010 pytest
11+ mock
1112covercmd =
1213 py.test --quiet \
1314 --cov =google.cloud.monitoring \
Original file line number Diff line number Diff line change @@ -185,8 +185,7 @@ def test_resource_factory(self):
185185
186186 def test_timeseries_factory_gauge (self ):
187187 import datetime
188- from google .cloud ._testing import _Monkey
189- import google .cloud .monitoring .client
188+ import mock
190189 from google .cloud ._helpers import _datetime_to_rfc3339
191190 METRIC_TYPE = 'custom.googleapis.com/my_metric'
192191 METRIC_LABELS = {
@@ -222,7 +221,8 @@ def test_timeseries_factory_gauge(self):
222221 TIME2_STR = _datetime_to_rfc3339 (TIME2 , ignore_zone = False )
223222 # Construct a time series assuming a gauge metric using the current
224223 # time
225- with _Monkey (google .cloud .monitoring .client , _UTCNOW = lambda : TIME2 ):
224+ with mock .patch ('google.cloud.monitoring.client._UTCNOW' ,
225+ new = lambda : TIME2 ):
226226 timeseries_no_end = client .time_series (metric , resource , VALUE )
227227
228228 self .assertEqual (timeseries_no_end .points [0 ].end_time , TIME2_STR )
Original file line number Diff line number Diff line change @@ -130,8 +130,7 @@ def test_constructor_maximal(self):
130130
131131 def test_constructor_default_end_time (self ):
132132 import datetime
133- from google .cloud ._testing import _Monkey
134- from google .cloud .monitoring import query as MUT
133+ import mock
135134
136135 MINUTES = 5
137136 NOW , T0 , T1 = [
@@ -141,7 +140,8 @@ def test_constructor_default_end_time(self):
141140 ]
142141
143142 client = _Client (project = PROJECT , connection = _Connection ())
144- with _Monkey (MUT , _UTCNOW = lambda : NOW ):
143+ with mock .patch ('google.cloud.monitoring.query._UTCNOW' ,
144+ new = lambda : NOW ):
145145 query = self ._make_one (client , METRIC_TYPE , minutes = MINUTES )
146146
147147 self .assertEqual (query ._start_time , T0 )
You can’t perform that action at this time.
0 commit comments