summaryrefslogtreecommitdiff
path: root/chromium/testing/test_env_unittest.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/testing/test_env_unittest.py
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/testing/test_env_unittest.py')
-rwxr-xr-xchromium/testing/test_env_unittest.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/chromium/testing/test_env_unittest.py b/chromium/testing/test_env_unittest.py
index 76d5766debc..707c65e9fdf 100755
--- a/chromium/testing/test_env_unittest.py
+++ b/chromium/testing/test_env_unittest.py
@@ -17,20 +17,29 @@ import sys
import time
import unittest
-
-TEST_SCRIPT = 'test_env_user_script.py'
+HERE = os.path.dirname(os.path.abspath(__file__))
+TEST_SCRIPT = os.path.join(HERE, 'test_env_user_script.py')
def launch_process_windows(args):
+ # The `universal_newlines` option is equivalent to `text` in Python 3.
return subprocess.Popen(
- [sys.executable, TEST_SCRIPT] + args, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, env=os.environ.copy(),
- creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
+ [sys.executable, TEST_SCRIPT] + args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ env=os.environ.copy(),
+ creationflags=subprocess.CREATE_NEW_PROCESS_GROUP,
+ universal_newlines=True)
+
def launch_process_nonwindows(args):
+ # The `universal_newlines` option is equivalent to `text` in Python 3.
return subprocess.Popen(
- [sys.executable, TEST_SCRIPT] + args, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, env=os.environ.copy())
+ [sys.executable, TEST_SCRIPT] + args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ env=os.environ.copy(),
+ universal_newlines=True)
def read_subprocess_message(proc, starts_with):
@@ -58,7 +67,7 @@ class SignalingWindowsTest(unittest.TestCase):
proc = launch_process_windows([])
send_and_wait(proc, signal.CTRL_BREAK_EVENT)
sig = read_subprocess_message(proc, 'Signal :')
- self.assertEqual(sig, str(signal.SIGBREAK))
+ self.assertEqual(sig, str(int(signal.SIGBREAK)))
class SignalingNonWindowsTest(unittest.TestCase):
@@ -72,13 +81,13 @@ class SignalingNonWindowsTest(unittest.TestCase):
proc = launch_process_nonwindows([])
send_and_wait(proc, signal.SIGTERM)
sig = read_subprocess_message(proc, 'Signal :')
- self.assertEqual(sig, str(signal.SIGTERM))
+ self.assertEqual(sig, str(int(signal.SIGTERM)))
def test_send_sigint(self):
proc = launch_process_nonwindows([])
send_and_wait(proc, signal.SIGINT)
sig = read_subprocess_message(proc, 'Signal :')
- self.assertEqual(sig, str(signal.SIGINT))
+ self.assertEqual(sig, str(int(signal.SIGINT)))
if __name__ == '__main__':