Mercurial > public > mercurial-scm > hg
comparison tests/test-hgweb-auth.py @ 28808:10c2ce44c35d
test-hgweb-auth: stop direct symbol import of mercurial.error.Abort
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 05 Apr 2016 23:21:17 +0900 |
parents | 736f64b23a24 |
children | 032c4c2f802a |
comparison
equal
deleted
inserted
replaced
28807:736f64b23a24 | 28808:10c2ce44c35d |
---|---|
1 from __future__ import absolute_import, print_function | 1 from __future__ import absolute_import, print_function |
2 | 2 |
3 from mercurial import demandimport; demandimport.enable() | 3 from mercurial import demandimport; demandimport.enable() |
4 import urllib2 | 4 import urllib2 |
5 from mercurial import ( | 5 from mercurial import ( |
6 error, | |
6 ui as uimod, | 7 ui as uimod, |
7 url, | 8 url, |
8 util, | 9 util, |
9 ) | |
10 from mercurial.error import ( | |
11 Abort, | |
12 ) | 10 ) |
13 | 11 |
14 class myui(uimod.ui): | 12 class myui(uimod.ui): |
15 def interactive(self): | 13 def interactive(self): |
16 return False | 14 return False |
46 pm = url.passwordmgr(ui) | 44 pm = url.passwordmgr(ui) |
47 u, authinfo = util.url(uri).authinfo() | 45 u, authinfo = util.url(uri).authinfo() |
48 if authinfo is not None: | 46 if authinfo is not None: |
49 pm.add_password(*authinfo) | 47 pm.add_password(*authinfo) |
50 print(' ', pm.find_user_password('test', u)) | 48 print(' ', pm.find_user_password('test', u)) |
51 except Abort: | 49 except error.Abort: |
52 print(' ','abort') | 50 print(' ','abort') |
53 | 51 |
54 if not urls: | 52 if not urls: |
55 urls = [ | 53 urls = [ |
56 'http://example.org/foo', | 54 'http://example.org/foo', |