Patchwork D12245: tests: unconditionalize some imports

login
register
mail settings
Submitter phabricator
Date March 2, 2022, 12:43 a.m.
Message ID <differential-rev-PHID-DREV-udjjab25omog5wc3kbb4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50584/
State New
Headers show

Comments

phabricator - March 2, 2022, 12:43 a.m.
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that we require Python 3 we can simplify these imports.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12245

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -57,8 +57,10 @@ 
 import multiprocessing
 import os
 import platform
+import queue
 import random
 import re
+import shlex
 import shutil
 import signal
 import socket
@@ -73,20 +75,7 @@ 
 import xml.dom.minidom as minidom
 
 WINDOWS = os.name == r'nt'
-
-try:
-    import Queue as queue
-except ImportError:
-    import queue
-
-try:
-    import shlex
-
-    shellquote = shlex.quote
-except (ImportError, AttributeError):
-    import pipes
-
-    shellquote = pipes.quote
+shellquote = shlex.quote
 
 
 processlock = threading.Lock()