diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t
index c8f62920f07a40af3403ba9aefa1dac8a97d53ea_dGVzdHMvdGVzdC1odHRwLWJ1bmRsZTEudA==..5ac0f2a8ba7205266a206ad8da89a79173e8efea_dGVzdHMvdGVzdC1odHRwLWJ1bmRsZTEudA== 100644
--- a/tests/test-http-bundle1.t
+++ b/tests/test-http-bundle1.t
@@ -192,6 +192,6 @@
   $ cat pid >> $DAEMON_PIDS
 
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
@@ -197,5 +197,5 @@
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
 
   $ hg id http://localhost:$HGPORT2/
diff --git a/tests/test-http.t b/tests/test-http.t
index c8f62920f07a40af3403ba9aefa1dac8a97d53ea_dGVzdHMvdGVzdC1odHRwLnQ=..5ac0f2a8ba7205266a206ad8da89a79173e8efea_dGVzdHMvdGVzdC1odHRwLnQ= 100644
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -181,6 +181,6 @@
   $ cat pid >> $DAEMON_PIDS
 
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
@@ -186,5 +186,5 @@
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
 
   $ hg id http://localhost:$HGPORT2/
diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t
index c8f62920f07a40af3403ba9aefa1dac8a97d53ea_dGVzdHMvdGVzdC1sYXJnZWZpbGVzLXdpcmVwcm90by50..5ac0f2a8ba7205266a206ad8da89a79173e8efea_dGVzdHMvdGVzdC1sYXJnZWZpbGVzLXdpcmVwcm90by50 100644
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -425,6 +425,6 @@
   >          -d -p $HGPORT --pid-file hg.pid -A access.log
   $ cat hg.pid >> $DAEMON_PIDS
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
@@ -430,5 +430,5 @@
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
   $ hg clone --config ui.interactive=true --config extensions.getpass=get_pass.py \
   >          http://user@localhost:$HGPORT credentialclone