Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: infra_libs/ts_mon/test/helpers_test.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: clean up code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 import mock 7 import mock
8 8
9 from infra_libs.ts_mon import helpers
10 from infra_libs.ts_mon import metrics 9 from infra_libs.ts_mon import metrics
10 from infra_libs.ts_mon.gae import helpers
11 11
12 12
13 class ScopedIncrementCounterTest(unittest.TestCase): 13 class ScopedIncrementCounterTest(unittest.TestCase):
14 14
15 def test_success(self): 15 def test_success(self):
16 counter = mock.Mock(metrics.CounterMetric) 16 counter = mock.Mock(metrics.CounterMetric)
17 with helpers.ScopedIncrementCounter(counter): 17 with helpers.ScopedIncrementCounter(counter):
18 pass 18 pass
19 counter.increment.assert_called_once_with({'status': 'success'}) 19 counter.increment.assert_called_once_with({'status': 'success'})
20 20
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 with helpers.ScopedIncrementCounter(counter, 'a', 'b', 'c'): 57 with helpers.ScopedIncrementCounter(counter, 'a', 'b', 'c'):
58 pass 58 pass
59 counter.increment.assert_called_once_with({'a': 'b'}) 59 counter.increment.assert_called_once_with({'a': 'b'})
60 60
61 def test_custom_label_exception(self): 61 def test_custom_label_exception(self):
62 counter = mock.Mock(metrics.CounterMetric) 62 counter = mock.Mock(metrics.CounterMetric)
63 with self.assertRaises(Exception): 63 with self.assertRaises(Exception):
64 with helpers.ScopedIncrementCounter(counter, 'a', 'b', 'c'): 64 with helpers.ScopedIncrementCounter(counter, 'a', 'b', 'c'):
65 raise Exception() 65 raise Exception()
66 counter.increment.assert_called_once_with({'a': 'c'}) 66 counter.increment.assert_called_once_with({'a': 'c'})
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698