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

Unified Diff: recipe_engine/unittests/run_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: Don't need a lock because we're single threaded now! 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
Index: recipe_engine/unittests/run_test.py
diff --git a/recipe_engine/unittests/run_test.py b/recipe_engine/unittests/run_test.py
index da6b81c15c163f500fed04959cb2a9e1417f6a4e..06ead3fe0c2cbfbb9b70c33fbad7ba82771cbd27 100755
--- a/recipe_engine/unittests/run_test.py
+++ b/recipe_engine/unittests/run_test.py
@@ -9,6 +9,7 @@ import re
import subprocess
import sys
import unittest
+import time
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))))
@@ -143,7 +144,7 @@ class RunTest(unittest.TestCase):
self._run_cmd('engine_tests/subannotations'),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- stdout, stderr = proc.communicate()
+ stdout, _ = proc.communicate()
self.assertRegexpMatches(stdout, r'(?m)^!@@@BUILD_STEP@steppy@@@$')
self.assertRegexpMatches(stdout, r'(?m)^@@@BUILD_STEP@pippy@@@$')
# Before 'Subannotate me' we expect an extra STEP_CURSOR to reset the
@@ -151,6 +152,16 @@ class RunTest(unittest.TestCase):
self.assertRegexpMatches(stdout,
r'(?m)^@@@STEP_CURSOR@Subannotate me@@@\n@@@STEP_CLOSED@@@$')
+ def test_bad_subprocess(self):
+ now = time.time()
+ self._test_recipe('engine_tests/bad_subprocess')
+ after = time.time()
+
+ # Test has an internal 10s timeout for the bad daemon step, but the daemon's
+ # parent process quits immediately. If this takes longer than 5 seconds to
+ # run, we consider it failed.
+ self.assertLess(after - now, 5)
+
if __name__ == '__main__':
unittest.TestCase.maxDiff = None

Powered by Google App Engine
This is Rietveld 408576698