Patchwork [10,of,12] tests: migrate demandimport.py away from deprecated `util` module symbols

login
register
mail settings
Submitter Matt Harbison
Date May 11, 2018, 5:11 a.m.
Message ID <4f38912f69dc5709c099.1526015483@Envy>
Download mbox | patch
Permalink /patch/31501/
State Accepted
Headers show

Comments

Matt Harbison - May 11, 2018, 5:11 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1526014731 14400
#      Fri May 11 00:58:51 2018 -0400
# Node ID 4f38912f69dc5709c0994a43741b91cf0bafcde4
# Parent  130f5016ec6b87f7cb3516f03f1ffbc3d4285897
tests: migrate demandimport.py away from deprecated `util` module symbols

Patch

diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -58,12 +58,12 @@  print("os =", f(os))
 print("os.system =", f(os.system))
 print("os =", f(os))
 
-from mercurial import util
+from mercurial.utils import procutil
 
-print("util =", f(util))
-print("util.system =", f(util.system))
-print("util =", f(util))
-print("util.system =", f(util.system))
+print("procutil =", f(procutil))
+print("procutil.system =", f(procutil.system))
+print("procutil =", f(procutil))
+print("procutil.system =", f(procutil.system))
 
 from mercurial import hgweb
 print("hgweb =", f(hgweb))
@@ -100,6 +100,8 @@  except ImportError as inst:
     print('contextlib.unknownattr = ImportError: %s'
           % rsub(r"'", '', str(inst)))
 
+from mercurial import util
+
 # Unlike the import statement, __import__() function should not raise
 # ImportError even if fromlist has an unknown item
 # (see Python/import.c:import_module_level() and ensure_fromlist())
diff --git a/tests/test-demandimport.py.out b/tests/test-demandimport.py.out
--- a/tests/test-demandimport.py.out
+++ b/tests/test-demandimport.py.out
@@ -7,10 +7,10 @@  errorproxy = <proxied module 'error'>
 os = <unloaded module 'os'>
 os.system = <built-in function system>
 os = <module 'os' from '?'>
-util = <unloaded module 'util'>
-util.system = <function system at 0x?>
-util = <module 'mercurial.util' from '?'>
-util.system = <function system at 0x?>
+procutil = <unloaded module 'procutil'>
+procutil.system = <function system at 0x?>
+procutil = <module 'mercurial.utils.procutil' from '?'>
+procutil.system = <function system at 0x?>
 hgweb = <unloaded module 'hgweb'>
 hgweb_mod = <unloaded module 'hgweb_mod'>
 hgweb = <module 'mercurial.hgweb' from '?'>