Mercurial > public > mercurial-scm > hg
annotate tests/test-util.py @ 48873:5aafc3c5bdec
py3: use io.BytesIO directly
Previously, pycompat.bytesio and pycompat.stringio referred to
io.BytesIO. And util.bytesio and util.stringio aliased the pycompat
symbols.
This commit switches everything to use io.BytesIO directly. util.bytesio
and util.stringio still exist to provide backwards compatibility, as
they were the preferred symbols.
Differential Revision: https://phab.mercurial-scm.org/D12252
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 15:03:26 -0700 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
rev | line source |
---|---|
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
1 # unit tests for mercuril.util utilities |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
2 from __future__ import absolute_import |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
3 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
4 import contextlib |
48873
5aafc3c5bdec
py3: use io.BytesIO directly
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43076
diff
changeset
|
5 import io |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
6 import itertools |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
7 import unittest |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
8 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
9 from mercurial import pycompat, util, utils |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
10 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
11 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
12 @contextlib.contextmanager |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
13 def mocktimer(incr=0.1, *additional_targets): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
14 """Replaces util.timer and additional_targets with a mock |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
15 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
16 The timer starts at 0. On each call the time incremented by the value |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
17 of incr. If incr is an iterable, then the time is incremented by the |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
18 next value from that iterable, looping in a cycle when reaching the end. |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
19 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
20 additional_targets must be a sequence of (object, attribute_name) tuples; |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
21 the mock is set with setattr(object, attribute_name, mock). |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
22 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
23 """ |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
24 time = [0] |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
25 try: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
26 incr = itertools.cycle(incr) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
27 except TypeError: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
28 incr = itertools.repeat(incr) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
29 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
30 def timer(): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
31 time[0] += next(incr) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
32 return time[0] |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
33 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
34 # record original values |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
35 orig = util.timer |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
36 additional_origs = [(o, a, getattr(o, a)) for o, a in additional_targets] |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
37 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
38 # mock out targets |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
39 util.timer = timer |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
40 for obj, attr in additional_targets: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
41 setattr(obj, attr, timer) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
42 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
43 try: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
44 yield |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
45 finally: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
46 # restore originals |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
47 util.timer = orig |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
48 for args in additional_origs: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
49 setattr(*args) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
50 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
51 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
52 # attr.s default factory for util.timedstats.start binds the timer we |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
53 # need to mock out. |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
54 _start_default = (util.timedcmstats.start.default, 'factory') |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
55 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
56 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
57 @contextlib.contextmanager |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
58 def capturestderr(): |
48873
5aafc3c5bdec
py3: use io.BytesIO directly
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43076
diff
changeset
|
59 """Replace utils.procutil.stderr with an io.BytesIO instance |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
60 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
61 The instance is made available as the return value of __enter__. |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
62 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
63 This contextmanager is reentrant. |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
64 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
65 """ |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
66 orig = utils.procutil.stderr |
48873
5aafc3c5bdec
py3: use io.BytesIO directly
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43076
diff
changeset
|
67 utils.procutil.stderr = io.BytesIO() |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
68 try: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
69 yield utils.procutil.stderr |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
70 finally: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
71 utils.procutil.stderr = orig |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
72 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
73 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
74 class timedtests(unittest.TestCase): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
75 def testtimedcmstatsstr(self): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
76 stats = util.timedcmstats() |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
77 self.assertEqual(str(stats), '<unknown>') |
38812
9d49bb117dde
util: make new timedcmstats class Python 3 compatible
Martijn Pieters <mj@zopatista.com>
parents:
38797
diff
changeset
|
78 self.assertEqual(bytes(stats), b'<unknown>') |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
79 stats.elapsed = 12.34 |
38812
9d49bb117dde
util: make new timedcmstats class Python 3 compatible
Martijn Pieters <mj@zopatista.com>
parents:
38797
diff
changeset
|
80 self.assertEqual(str(stats), pycompat.sysstr(util.timecount(12.34))) |
9d49bb117dde
util: make new timedcmstats class Python 3 compatible
Martijn Pieters <mj@zopatista.com>
parents:
38797
diff
changeset
|
81 self.assertEqual(bytes(stats), util.timecount(12.34)) |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
82 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
83 def testtimedcmcleanexit(self): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
84 # timestamps 1, 4, elapsed time of 4 - 1 = 3 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
85 with mocktimer([1, 3], _start_default): |
39258
331ab85e910b
cleanup: make all uses of timedcm specify what they're timing
Augie Fackler <augie@google.com>
parents:
38812
diff
changeset
|
86 with util.timedcm('pass') as stats: |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
87 # actual context doesn't matter |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
88 pass |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
89 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
90 self.assertEqual(stats.start, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
91 self.assertEqual(stats.elapsed, 3) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
92 self.assertEqual(stats.level, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
93 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
94 def testtimedcmnested(self): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
95 # timestamps 1, 3, 6, 10, elapsed times of 6 - 3 = 3 and 10 - 1 = 9 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
96 with mocktimer([1, 2, 3, 4], _start_default): |
39258
331ab85e910b
cleanup: make all uses of timedcm specify what they're timing
Augie Fackler <augie@google.com>
parents:
38812
diff
changeset
|
97 with util.timedcm('outer') as outer_stats: |
331ab85e910b
cleanup: make all uses of timedcm specify what they're timing
Augie Fackler <augie@google.com>
parents:
38812
diff
changeset
|
98 with util.timedcm('inner') as inner_stats: |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
99 # actual context doesn't matter |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
100 pass |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
101 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
102 self.assertEqual(outer_stats.start, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
103 self.assertEqual(outer_stats.elapsed, 9) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
104 self.assertEqual(outer_stats.level, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
105 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
106 self.assertEqual(inner_stats.start, 3) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
107 self.assertEqual(inner_stats.elapsed, 3) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
108 self.assertEqual(inner_stats.level, 2) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
109 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
110 def testtimedcmexception(self): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
111 # timestamps 1, 4, elapsed time of 4 - 1 = 3 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
112 with mocktimer([1, 3], _start_default): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
113 try: |
39258
331ab85e910b
cleanup: make all uses of timedcm specify what they're timing
Augie Fackler <augie@google.com>
parents:
38812
diff
changeset
|
114 with util.timedcm('exceptional') as stats: |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
115 raise ValueError() |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
116 except ValueError: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
117 pass |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
118 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
119 self.assertEqual(stats.start, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
120 self.assertEqual(stats.elapsed, 3) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
121 self.assertEqual(stats.level, 1) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
122 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
123 def testtimeddecorator(self): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
124 @util.timed |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
125 def testfunc(callcount=1): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
126 callcount -= 1 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
127 if callcount: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
128 testfunc(callcount) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
129 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
130 # timestamps 1, 2, 3, 4, elapsed time of 3 - 2 = 1 and 4 - 1 = 3 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
131 with mocktimer(1, _start_default): |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
132 with capturestderr() as out: |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
133 testfunc(2) |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
134 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
135 self.assertEqual( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
136 out.getvalue(), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
137 (b' testfunc: 1.000 s\n' b' testfunc: 3.000 s\n'), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
138 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
139 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
140 |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
141 if __name__ == '__main__': |
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
142 import silenttestrunner |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39258
diff
changeset
|
143 |
38797
8751d1e2a7ff
util: create a context manager to handle timing
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
144 silenttestrunner.main(__name__) |