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

Unified Diff: recipe_engine/unittests/step_runner_test.py

Issue 1959563002: Use subprocess42 in recipe_engine to avoid threading madness. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: *sigh* presubmit Created 4 years, 7 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 | « recipe_engine/unittests/run_test.py ('k') | recipes/engine_tests/bad_subprocess.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/unittests/step_runner_test.py
diff --git a/recipe_engine/unittests/step_runner_test.py b/recipe_engine/unittests/step_runner_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..66c74de968ebfafd47d296edafe35e547a4d27da
--- /dev/null
+++ b/recipe_engine/unittests/step_runner_test.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import shutil
+import sys
+import tempfile
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__)))))
+
+from recipe_engine import step_runner
+
+
+class TestLinebuf(unittest.TestCase):
+ def test_add_partial(self):
+ lb = step_runner._streamingLinebuf()
+ lb.ingest("blarf")
+ self.assertEqual([], lb.get_buffered())
+
+ self.assertEqual([], lb.buffedlines)
+ self.assertEqual("blarf", lb.extra.getvalue())
+
+ def test_add_whole(self):
+ lb = step_runner._streamingLinebuf()
+ lb.ingest("blarf\n")
+ self.assertEqual(["blarf"], lb.get_buffered())
+
+ self.assertEqual([], lb.buffedlines)
+ self.assertEqual("", lb.extra.getvalue())
+
+ def test_add_partial_whole(self):
+ lb = step_runner._streamingLinebuf()
+ lb.ingest("foof\nfleem\nblarf")
+ self.assertEqual(["foof", "fleem"], lb.get_buffered())
+
+ lb.ingest("dweeble\nwat")
+ self.assertEqual(["blarfdweeble"], lb.get_buffered())
+
+ self.assertEqual([], lb.buffedlines)
+ self.assertEqual("wat", lb.extra.getvalue())
+
+ def test_leftovers(self):
+ lb = step_runner._streamingLinebuf()
+
+ lb.ingest("nerds")
+ self.assertEqual([], lb.get_buffered())
+
+ lb.ingest("doop\n")
+ self.assertEqual(["nerdsdoop"], lb.get_buffered())
+
+ self.assertEqual([], lb.get_buffered())
+
+ self.assertEqual([], lb.buffedlines)
+ self.assertEqual("", lb.extra.getvalue())
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « recipe_engine/unittests/run_test.py ('k') | recipes/engine_tests/bad_subprocess.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698