From d535cd70e034b4ccdccf8b7d9243ffa931a46c78 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Tue, 5 Nov 2024 21:24:20 +0000 Subject: [PATCH] Bug 1926140 - Replace pipes imports r=jmaher pipes does not exist in Python 3.11 any more Differential Revision: https://phabricator.services.mozilla.com/D227964 --- js/src/tests/lib/results.py | 4 ++-- testing/mozbase/mozdevice/mozdevice/adb.py | 3 --- testing/web-platform/tests/tools/pytest.ini | 2 -- testing/xpcshell/runxpcshelltests.py | 6 +++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py index 42f8d7c163bce..1d18b9eb69de3 100644 --- a/js/src/tests/lib/results.py +++ b/js/src/tests/lib/results.py @@ -1,6 +1,6 @@ import json -import pipes import re +import shlex from .progressbar import NullProgressBar, ProgressBar from .structuredlog import TestLogger @@ -9,7 +9,7 @@ def escape_cmdline(args): - return " ".join([pipes.quote(a) for a in args]) + return " ".join([shlex.quote(a) for a in args]) class TestOutput: diff --git a/testing/mozbase/mozdevice/mozdevice/adb.py b/testing/mozbase/mozdevice/mozdevice/adb.py index 0495e863aa679..d06f40e4915b5 100644 --- a/testing/mozbase/mozdevice/mozdevice/adb.py +++ b/testing/mozbase/mozdevice/mozdevice/adb.py @@ -4,7 +4,6 @@ import io import os -import pipes import posixpath import re import shlex @@ -1293,8 +1292,6 @@ def _quote(arg): """Utility function to return quoted version of command argument.""" if hasattr(shlex, "quote"): quote = shlex.quote - elif hasattr(pipes, "quote"): - quote = pipes.quote else: def quote(arg): diff --git a/testing/web-platform/tests/tools/pytest.ini b/testing/web-platform/tests/tools/pytest.ini index 650d07caf3a67..3f3d0983ab183 100644 --- a/testing/web-platform/tests/tools/pytest.ini +++ b/testing/web-platform/tests/tools/pytest.ini @@ -20,8 +20,6 @@ filterwarnings = ignore:This method will be removed in .*\.\s+Use 'parser\.read_file\(\)' instead\.:DeprecationWarning:mozversion # ignore mozversion not cleanly closing .ini files ignore:unclosed file.*\.ini:ResourceWarning:mozversion - # mozdevice uses pipes module - ignore:'pipes' is deprecated and slated for removal in Python 3:DeprecationWarning # mozrunner uses telnetlib module ignore:'telnetlib' is deprecated and slated for removal in Python 3:DeprecationWarning # https://github.com/web-platform-tests/wpt/issues/39366 diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 77b26a39aa12c..45ca22ac0430a 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -7,10 +7,10 @@ import copy import json import os -import pipes import platform import random import re +import shlex import shutil import signal import subprocess @@ -372,11 +372,11 @@ def logCommand(self, name, completeCmd, testdir): ) self.log.info("%s | environment: %s" % (name, list(changedEnv))) shell_command_tokens = [ - pipes.quote(tok) for tok in list(changedEnv) + completeCmd + shlex.quote(tok) for tok in list(changedEnv) + completeCmd ] self.log.info( "%s | as shell command: (cd %s; %s)" - % (name, pipes.quote(testdir), " ".join(shell_command_tokens)) + % (name, shlex.quote(testdir), " ".join(shell_command_tokens)) ) def killTimeout(self, proc):