Increase SignalingWindowsTest timeout
SignalingWindowsTest continues to fail occasionally because it is
fundamentally racy - it has a timeout, and sometimes it isn't long
enough. This change doubles the timeout, in hopes that this will reduce
the failure frequency.
While in there I updated the shebang to python3 and resolved a couple of
easy pylint warnings that had been suppressed.
Bug: 1335123
Change-Id: Iccd718980f62a0b120f22c053496e5e3bdf25885
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3809751
Reviewed-by: Ben Pastene <[email protected]>
Commit-Queue: Bruce Dawson <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1031548}
diff --git a/testing/test_env_unittest.py b/testing/test_env_unittest.py
index 8ec6194..c7ff637 100755
--- a/testing/test_env_unittest.py
+++ b/testing/test_env_unittest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2019 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.
@@ -20,8 +20,6 @@
HERE = os.path.dirname(os.path.abspath(__file__))
TEST_SCRIPT = os.path.join(HERE, 'test_env_user_script.py')
-# pylint: disable=super-with-arguments
-
def launch_process_windows(args):
# The `universal_newlines` option is equivalent to `text` in Python 3.
@@ -53,7 +51,7 @@
# pylint: enable=inconsistent-return-statements
-def send_and_wait(proc, sig, sleep_time=0.3):
+def send_and_wait(proc, sig, sleep_time=0.6):
"""Sends a signal to subprocess."""
time.sleep(sleep_time) # gives process time to launch.
os.kill(proc.pid, sig)
@@ -63,7 +61,7 @@
class SignalingWindowsTest(unittest.TestCase):
def setUp(self):
- super(SignalingWindowsTest, self).setUp()
+ super().setUp()
if sys.platform != 'win32':
self.skipTest('test only runs on Windows')
@@ -71,13 +69,17 @@
proc = launch_process_windows([])
send_and_wait(proc, signal.CTRL_BREAK_EVENT) # pylint: disable=no-member
sig = read_subprocess_message(proc, 'Signal :')
+ # This test is flaky because it relies on the child process starting quickly
+ # "enough", which it fails to do sometimes. This is tracked by
+ # https://crbug.com/1335123 and it is hoped that increasing the timeout will
+ # reduce the flakiness.
self.assertEqual(sig, str(int(signal.SIGBREAK))) # pylint: disable=no-member
class SignalingNonWindowsTest(unittest.TestCase):
def setUp(self):
- super(SignalingNonWindowsTest, self).setUp()
+ super().setUp()
if sys.platform == 'win32':
self.skipTest('test does not run on Windows')