comparison tests/test-hgweb-non-interactive.t @ 40203:f80f7a67e176

tests: fix style issue of importing hgweb in embedded code fragments Some test scripts are excluded in test-check-module-imports.t, because import-checker.py reports that hgweb and/or hgwebdir of mercurial.hgweb are not imported in recommended style. To fix this issues, this patch make python code fragments embedded in these files import hgweb from mercurial package at first, and refer hgweb and hgwebdir via imported hgweb.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 08 Oct 2018 10:10:06 +0900
parents 8bd589aecf65
children 4c1b4805db57
comparison
equal deleted inserted replaced
40202:56ea22fa55f0 40203:f80f7a67e176
17 > pycompat, 17 > pycompat,
18 > ui as uimod, 18 > ui as uimod,
19 > util, 19 > util,
20 > ) 20 > )
21 > ui = uimod.ui 21 > ui = uimod.ui
22 > from mercurial.hgweb.hgweb_mod import ( 22 > from mercurial.hgweb import hgweb_mod
23 > hgweb,
24 > )
25 > stringio = util.stringio 23 > stringio = util.stringio
26 > 24 >
27 > class FileLike(object): 25 > class FileLike(object):
28 > def __init__(self, real): 26 > def __init__(self, real):
29 > self.real = real 27 > self.real = real
65 > 'SERVER_NAME': '$LOCALIP', 63 > 'SERVER_NAME': '$LOCALIP',
66 > 'SERVER_PORT': os.environ['HGPORT'], 64 > 'SERVER_PORT': os.environ['HGPORT'],
67 > 'SERVER_PROTOCOL': 'HTTP/1.0' 65 > 'SERVER_PROTOCOL': 'HTTP/1.0'
68 > } 66 > }
69 > 67 >
70 > i = hgweb(b'.') 68 > i = hgweb_mod.hgweb(b'.')
71 > for c in i(env, startrsp): 69 > for c in i(env, startrsp):
72 > pass 70 > pass
73 > sys.stdout.flush() 71 > sys.stdout.flush()
74 > pycompat.stdout.write(b'---- ERRORS\n') 72 > pycompat.stdout.write(b'---- ERRORS\n')
75 > pycompat.stdout.write(b'%s\n' % errors.getvalue()) 73 > pycompat.stdout.write(b'%s\n' % errors.getvalue())