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

Unified Diff: scripts/common/unittests/annotator_test.py

Issue 2050703003: Add CURRENT_TIMESTAMP annotation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: updated comment Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/common/annotator.py ('k') | scripts/master/chromium_step.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/common/unittests/annotator_test.py
diff --git a/scripts/common/unittests/annotator_test.py b/scripts/common/unittests/annotator_test.py
index 9a9011c2991c144148f4bea3baeb569f695758a1..1b59bdfbfc498b678b2381dbdc93a264884bce14 100755
--- a/scripts/common/unittests/annotator_test.py
+++ b/scripts/common/unittests/annotator_test.py
@@ -30,7 +30,8 @@ class TestAnnotationStreams(unittest.TestCase):
return [line for line in self.buf.getvalue().rstrip().split('\n') if line]
def testBasicUsage(self):
- stream = annotator.StructuredAnnotationStream(stream=self.buf)
+ stream = annotator.StructuredAnnotationStream(
+ stream=self.buf, time_fn=lambda: 123456)
with stream.step('one') as _:
pass
with stream.step('two') as _:
@@ -39,20 +40,25 @@ class TestAnnotationStreams(unittest.TestCase):
result = [
'@@@SEED_STEP one@@@',
'@@@STEP_CURSOR one@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_STARTED@@@',
'@@@STEP_CURSOR one@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_CLOSED@@@',
'@@@SEED_STEP two@@@',
'@@@STEP_CURSOR two@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_STARTED@@@',
'@@@STEP_CURSOR two@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_CLOSED@@@',
]
self.assertEquals(result, self._getLines())
def testStepAnnotations(self):
- stream = annotator.StructuredAnnotationStream(stream=self.buf)
+ stream = annotator.StructuredAnnotationStream(
+ stream=self.buf, time_fn=lambda: 123456)
with stream.step('one') as s:
s.step_warnings()
s.step_failure()
@@ -73,6 +79,7 @@ class TestAnnotationStreams(unittest.TestCase):
result = [
'@@@SEED_STEP one@@@',
'@@@STEP_CURSOR one@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_STARTED@@@',
'@@@STEP_WARNINGS@@@',
'@@@STEP_FAILURE@@@',
@@ -93,6 +100,7 @@ class TestAnnotationStreams(unittest.TestCase):
'@@@STEP_LOG_LINE@full_perf_log@perf line two@@@',
'@@@STEP_LOG_END_PERF@full_perf_log@full_perf@@@',
'@@@STEP_CURSOR one@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_CLOSED@@@',
]
@@ -146,7 +154,7 @@ class TestAnnotationStreams(unittest.TestCase):
def testStructured(self):
stream = annotator.StructuredAnnotationStream(
- stream=self.buf, flush_before=None)
+ stream=self.buf, flush_before=None, time_fn=lambda: 123456)
step = annotator.StructuredAnnotationStep(
annotation_stream=stream, stream=self.buf, flush_before=None)
stream.step_cursor('one')
@@ -160,8 +168,10 @@ class TestAnnotationStreams(unittest.TestCase):
result = [
'@@@STEP_CURSOR one@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_STARTED@@@',
'@@@STEP_CURSOR two@@@',
+ '@@@CURRENT_TIMESTAMP@123456@@@',
'@@@STEP_STARTED@@@',
'@@@STEP_CURSOR one@@@',
'@@@STEP_CLOSED@@@',
« no previous file with comments | « scripts/common/annotator.py ('k') | scripts/master/chromium_step.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698