# HG changeset patch
# User Yuya Nishihara
# Date 1607339556 -32400
# Mon Dec 07 20:12:36 2020 +0900
# Node ID e19bab808d0b3491121113509601f990fe5988f1
# Parent 1bf2b44c40078c4e17479a1625c57370dc7750ec
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.
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -154,7 +154,10 @@ Check that extensions are loaded in phas
> from mercurial import exthelper
> from mercurial.utils import procutil
>
- > write = procutil.stdout.write
+ > def write(msg):
+ > procutil.stdout.write(msg)
+ > procutil.stdout.flush()
+ >
> name = os.path.basename(__file__).rsplit('.', 1)[0]
> bytesname = name.encode('utf-8')
> write(b"1) %s imported\n" % bytesname)
@@ -194,6 +197,9 @@ Check that extensions are loaded in phas
Check normal command's load order of extensions and registration of functions
+ On chg server, extension should be first set up by the server. Then
+ object-level setup should follow in the worker process.
+
$ hg log -r "foo() and bar()" -q
1) foo imported
1) bar imported
@@ -209,6 +215,18 @@ Check normal command's load order of ext
4) bar uipopulate
5) foo reposetup
5) bar reposetup
+ 4) foo uipopulate (chg !)
+ 4) bar uipopulate (chg !)
+ 4) foo uipopulate (chg !)
+ 4) bar uipopulate (chg !)
+ 4) foo uipopulate (chg !)
+ 4) bar uipopulate (chg !)
+ 4) foo uipopulate (chg !)
+ 4) bar uipopulate (chg !)
+ 4) foo uipopulate (chg !)
+ 4) bar uipopulate (chg !)
+ 5) foo reposetup (chg !)
+ 5) bar reposetup (chg !)
0:c24b9ac61126
Check hgweb's load order of extensions and registration of functions
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel