Mercurial > public > mercurial-scm > hg
comparison tests/test-hgweb-auth.py @ 30559:d83ca854fa21
ui: factor out ui.load() to create a ui without loading configs (API)
This allows us to write doctests depending on a ui object, but not on global
configs.
ui.load() is a class method so we can do wsgiui.load(). All ui() calls but
for doctests are replaced with ui.load(). Some of them could be changed to
not load configs later.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 22 Oct 2016 14:35:10 +0900 |
parents | 2c019aac6b99 |
children | ba479850c9c7 |
comparison
equal
deleted
inserted
replaced
30557:cbeb54ec0481 | 30559:d83ca854fa21 |
---|---|
13 | 13 |
14 class myui(uimod.ui): | 14 class myui(uimod.ui): |
15 def interactive(self): | 15 def interactive(self): |
16 return False | 16 return False |
17 | 17 |
18 origui = myui() | 18 origui = myui.load() |
19 | 19 |
20 def writeauth(items): | 20 def writeauth(items): |
21 ui = origui.copy() | 21 ui = origui.copy() |
22 for name, value in items.iteritems(): | 22 for name, value in items.iteritems(): |
23 ui.setconfig('auth', name, value) | 23 ui.setconfig('auth', name, value) |