1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# HG changeset patch
# User Rob Wu <rob@robwu.nl>
# Date 1730841860 0
# Node ID d12754638c687fb1faccb217c2a44a5b66806c37
# Parent 652dabf039d013dd7acd287b5ed0a6d3ee916297
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
diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py
--- a/js/src/tests/lib/results.py
+++ b/js/src/tests/lib/results.py
@@ -1,20 +1,20 @@
import json
-import pipes
import re
+import shlex
from .progressbar import NullProgressBar, ProgressBar
from .structuredlog import TestLogger
# subprocess.list2cmdline does not properly escape for sh-like shells
def escape_cmdline(args):
- return " ".join([pipes.quote(a) for a in args])
+ return " ".join([shlex.quote(a) for a in args])
class TestOutput:
"""Output from a test run."""
def __init__(self, test, cmd, out, err, rc, dt, timed_out, extra=None):
self.test = test # Test
self.cmd = cmd # str: command line of test
diff --git a/testing/mozbase/mozdevice/mozdevice/adb.py b/testing/mozbase/mozdevice/mozdevice/adb.py
--- a/testing/mozbase/mozdevice/mozdevice/adb.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb.py
@@ -1,15 +1,14 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import io
import os
-import pipes
import posixpath
import re
import shlex
import shutil
import signal
import subprocess
import sys
import tempfile
@@ -1288,18 +1287,16 @@ class ADBDevice(ADBCommand):
re_quotable_chars = re.compile(r"[ ()\"&'\];]")
return re_quotable_chars.search(arg)
@staticmethod
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):
arg = arg or ""
re_unsafe = re.compile(r"[^\w@%+=:,./-]")
if re_unsafe.search(arg):
arg = "'" + arg.replace("'", "'\"'\"'") + "'"
return arg
diff --git a/testing/web-platform/tests/tools/pytest.ini b/testing/web-platform/tests/tools/pytest.ini
--- a/testing/web-platform/tests/tools/pytest.ini
+++ b/testing/web-platform/tests/tools/pytest.ini
@@ -15,18 +15,16 @@ filterwarnings =
# ignore mozinfo deprecation warnings
ignore:distutils Version classes are deprecated\. Use packaging\.version instead\.:DeprecationWarning:mozinfo
# ingore mozinfo's dependency on distro
ignore:distro\.linux_distribution\(\) is deprecated\. It should only be used as a compatibility shim with Python\'s platform\.linux_distribution\(\)\. Please use distro\.id\(\), distro\.version\(\) and distro\.name\(\) instead\.:DeprecationWarning
# ignore mozversion deprecation warnings
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
always:The metaschema specified by \$schema was not found\. Using the latest draft to validate, but this will raise an error in the future\.:DeprecationWarning
# https://github.com/web-platform-tests/wpt/issues/39359
always:'cgi' is deprecated and slated for removal in Python 3:DeprecationWarning
# https://github.com/web-platform-tests/wpt/issues/39373
always:the imp module is deprecated in favour of importlib:DeprecationWarning
diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -2,20 +2,20 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import copy
import json
import os
-import pipes
import platform
import random
import re
+import shlex
import shutil
import signal
import subprocess
import sys
import tempfile
import time
import traceback
from argparse import Namespace
@@ -367,21 +367,21 @@ class XPCShellTestThread(Thread):
self.log.info("%s | current directory: %r" % (name, testdir))
# Show only those environment variables that are changed from
# the ambient environment.
changedEnv = set("%s=%s" % i for i in six.iteritems(self.env)) - set(
"%s=%s" % i for i in six.iteritems(os.environ)
)
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):
if proc is not None and hasattr(proc, "pid"):
mozcrash.kill_and_get_minidump(
proc.pid, self.tempDir, utility_path=self.utility_path
)
else:
|