Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d659693

Browse files
committed
Improve the self-test code a bit: read a host from sys.argv[1] if set,
and list the host name when prompting for the password.
1 parent a119c0d commit d659693

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/imaplib.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,15 @@ def Time2Internaldate(date_time):
781781

782782
if __debug__ and __name__ == '__main__':
783783

784+
host = ''
785+
import sys
786+
if sys.argv[1:]:
787+
host = sys.argv[1]
788+
784789
import getpass
785790
USER = getpass.getuser()
786-
PASSWD = getpass.getpass()
791+
PASSWD = getpass.getpass(
792+
"IMAP password for %s: " % (host or "localhost"))
787793

788794
test_seq1 = (
789795
('login', (USER, PASSWD)),
@@ -815,7 +821,7 @@ def run(cmd, args):
815821
return dat
816822

817823
Debug = 4
818-
M = IMAP4()
824+
M = IMAP4(host)
819825
print 'PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION
820826

821827
for cmd,args in test_seq1:

0 commit comments

Comments
 (0)