comparison tests/test-extension.t @ 46069:56a5ea353182

test-extension: flush diagnostic message to stabilize chg output Since chg server may create new file object for the attached stdout, procutil.stdout is not ui.fout and the buffered procutil.stdout data wouldn't be flushed at all. That's why test-extension.t passes without modification on Python 2.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 07 Dec 2020 20:12:36 +0900
parents a120d1c9c704
children 0a4d47f4337b
comparison
equal deleted inserted replaced
46068:1f0ed7e63c2a 46069:56a5ea353182
152 > from __future__ import print_function 152 > from __future__ import print_function
153 > import os 153 > import os
154 > from mercurial import exthelper 154 > from mercurial import exthelper
155 > from mercurial.utils import procutil 155 > from mercurial.utils import procutil
156 > 156 >
157 > write = procutil.stdout.write 157 > def write(msg):
158 > procutil.stdout.write(msg)
159 > procutil.stdout.flush()
160 >
158 > name = os.path.basename(__file__).rsplit('.', 1)[0] 161 > name = os.path.basename(__file__).rsplit('.', 1)[0]
159 > bytesname = name.encode('utf-8') 162 > bytesname = name.encode('utf-8')
160 > write(b"1) %s imported\n" % bytesname) 163 > write(b"1) %s imported\n" % bytesname)
161 > eh = exthelper.exthelper() 164 > eh = exthelper.exthelper()
162 > @eh.uisetup 165 > @eh.uisetup
192 $ echo 'foo = foo.py' >> $HGRCPATH 195 $ echo 'foo = foo.py' >> $HGRCPATH
193 $ echo 'bar = bar.py' >> $HGRCPATH 196 $ echo 'bar = bar.py' >> $HGRCPATH
194 197
195 Check normal command's load order of extensions and registration of functions 198 Check normal command's load order of extensions and registration of functions
196 199
200 On chg server, extension should be first set up by the server. Then
201 object-level setup should follow in the worker process.
202
197 $ hg log -r "foo() and bar()" -q 203 $ hg log -r "foo() and bar()" -q
198 1) foo imported 204 1) foo imported
199 1) bar imported 205 1) bar imported
200 2) foo uisetup 206 2) foo uisetup
201 2) bar uisetup 207 2) bar uisetup
207 4) bar uipopulate 213 4) bar uipopulate
208 4) foo uipopulate 214 4) foo uipopulate
209 4) bar uipopulate 215 4) bar uipopulate
210 5) foo reposetup 216 5) foo reposetup
211 5) bar reposetup 217 5) bar reposetup
218 4) foo uipopulate (chg !)
219 4) bar uipopulate (chg !)
220 4) foo uipopulate (chg !)
221 4) bar uipopulate (chg !)
222 4) foo uipopulate (chg !)
223 4) bar uipopulate (chg !)
224 4) foo uipopulate (chg !)
225 4) bar uipopulate (chg !)
226 4) foo uipopulate (chg !)
227 4) bar uipopulate (chg !)
228 5) foo reposetup (chg !)
229 5) bar reposetup (chg !)
212 0:c24b9ac61126 230 0:c24b9ac61126
213 231
214 Check hgweb's load order of extensions and registration of functions 232 Check hgweb's load order of extensions and registration of functions
215 233
216 $ cat > hgweb.cgi <<EOF 234 $ cat > hgweb.cgi <<EOF