Skip to content
Snippets Groups Projects
Commit 265a78f9 authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

tests: extract getpass extension to dedicated file

Not only is this easier to view and edit, but it also avoids causing
issues with coverage.
parent 48575d96
No related branches found
No related tags found
1 merge request!136Gather coverage
......@@ -11,19 +11,5 @@
Allow password prompts without a TTY:
$ cat << EOF > get_pass.py
> from __future__ import generator_stop
> import getpass, os, sys
> def newgetpass(args):
> try:
> passwd = os.environb.get(b'PASSWD', b'nope')
> print(passwd.encode())
> except AttributeError: # python 2.7
> passwd = os.environ.get('PASSWD', 'nope')
> print(passwd)
> sys.stdout.flush()
> return passwd
> getpass.getpass = newgetpass
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
......@@ -28,6 +14,6 @@
$ cat >> $HGRCPATH << EOF
> [extensions]
> getpass = $TESTTMP/get_pass.py
> getpass = $TESTDIR/testlib/ext-get-password-from-env.py
> EOF
Create a silly SSH configuration:
......
#
# small dummy extension that obtains passwords from an environment
# variable
#
from __future__ import generator_stop
import getpass
import os
import sys
def newgetpass(args):
try:
passwd = os.environb.get(b'PASSWD', b'nope')
print(passwd.encode())
except AttributeError: # python 2.7
passwd = os.environ.get('PASSWD', 'nope')
print(passwd)
sys.stdout.flush()
return passwd
getpass.getpass = newgetpass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment