##// END OF EJS Templates
tests: update test-commandserver to pass our import checker
Augie Fackler -
r33923:1a6707b4 default
parent child Browse files
Show More
@@ -13,8 +13,10 b' typical client does not want echo-back m'
13 $ hg init repo
13 $ hg init repo
14 $ cd repo
14 $ cd repo
15
15
16 >>> from __future__ import print_function
16 >>> from __future__ import absolute_import, print_function
17 >>> from hgclient import readchannel, runcommand, check
17 >>> import os
18 >>> import sys
19 >>> from hgclient import check, readchannel, runcommand
18 >>> @check
20 >>> @check
19 ... def hellomessage(server):
21 ... def hellomessage(server):
20 ... ch, data = readchannel(server)
22 ... ch, data = readchannel(server)
@@ -32,7 +34,7 b' typical client does not want echo-back m'
32 ... server.stdin.write('unknowncommand\n')
34 ... server.stdin.write('unknowncommand\n')
33 abort: unknown command unknowncommand
35 abort: unknown command unknowncommand
34
36
35 >>> from hgclient import readchannel, runcommand, check
37 >>> from hgclient import check, readchannel, runcommand
36 >>> @check
38 >>> @check
37 ... def checkruncommand(server):
39 ... def checkruncommand(server):
38 ... # hello block
40 ... # hello block
@@ -91,7 +93,7 b' typical client does not want echo-back m'
91 abort: unknown revision 'unknown'!
93 abort: unknown revision 'unknown'!
92 [255]
94 [255]
93
95
94 >>> from hgclient import readchannel, check
96 >>> from hgclient import check, readchannel
95 >>> @check
97 >>> @check
96 ... def inputeof(server):
98 ... def inputeof(server):
97 ... readchannel(server)
99 ... readchannel(server)
@@ -103,7 +105,7 b' typical client does not want echo-back m'
103 ... print('server exit code =', server.wait())
105 ... print('server exit code =', server.wait())
104 server exit code = 1
106 server exit code = 1
105
107
106 >>> from hgclient import readchannel, runcommand, check, stringio
108 >>> from hgclient import check, readchannel, runcommand, stringio
107 >>> @check
109 >>> @check
108 ... def serverinput(server):
110 ... def serverinput(server):
109 ... readchannel(server)
111 ... readchannel(server)
@@ -138,7 +140,7 b' typical client does not want echo-back m'
138 check that "histedit --commands=-" can read rules from the input channel:
140 check that "histedit --commands=-" can read rules from the input channel:
139
141
140 >>> import cStringIO
142 >>> import cStringIO
141 >>> from hgclient import readchannel, runcommand, check
143 >>> from hgclient import check, readchannel, runcommand
142 >>> @check
144 >>> @check
143 ... def serverinput(server):
145 ... def serverinput(server):
144 ... readchannel(server)
146 ... readchannel(server)
@@ -152,7 +154,7 b" check that --cwd doesn't persist between"
152
154
153 $ mkdir foo
155 $ mkdir foo
154 $ touch foo/bar
156 $ touch foo/bar
155 >>> from hgclient import readchannel, runcommand, check
157 >>> from hgclient import check, readchannel, runcommand
156 >>> @check
158 >>> @check
157 ... def cwd(server):
159 ... def cwd(server):
158 ... readchannel(server)
160 ... readchannel(server)
@@ -173,7 +175,7 b' check that local configs for the cached '
173 > foo = bar
175 > foo = bar
174 > EOF
176 > EOF
175
177
176 >>> from hgclient import readchannel, sep, runcommand, check
178 >>> from hgclient import check, readchannel, runcommand, sep
177 >>> @check
179 >>> @check
178 ... def localhgrc(server):
180 ... def localhgrc(server):
179 ... readchannel(server)
181 ... readchannel(server)
@@ -223,7 +225,7 b' check that local configs for the cached '
223 > print('now try to read something: %r' % sys.stdin.read())
225 > print('now try to read something: %r' % sys.stdin.read())
224 > EOF
226 > EOF
225
227
226 >>> from hgclient import readchannel, runcommand, check, stringio
228 >>> from hgclient import check, readchannel, runcommand, stringio
227 >>> @check
229 >>> @check
228 ... def hookoutput(server):
230 ... def hookoutput(server):
229 ... readchannel(server)
231 ... readchannel(server)
@@ -240,7 +242,7 b' Clean hook cached version'
240
242
241 $ echo a >> a
243 $ echo a >> a
242 >>> import os
244 >>> import os
243 >>> from hgclient import readchannel, runcommand, check
245 >>> from hgclient import check, readchannel, runcommand
244 >>> @check
246 >>> @check
245 ... def outsidechanges(server):
247 ... def outsidechanges(server):
246 ... readchannel(server)
248 ... readchannel(server)
@@ -260,7 +262,7 b' Clean hook cached version'
260 *** runcommand status
262 *** runcommand status
261
263
262 >>> import os
264 >>> import os
263 >>> from hgclient import readchannel, runcommand, check
265 >>> from hgclient import check, readchannel, runcommand
264 >>> @check
266 >>> @check
265 ... def bookmarks(server):
267 ... def bookmarks(server):
266 ... readchannel(server)
268 ... readchannel(server)
@@ -299,7 +301,7 b' Clean hook cached version'
299
301
300
302
301 >>> import os
303 >>> import os
302 >>> from hgclient import readchannel, runcommand, check
304 >>> from hgclient import check, readchannel, runcommand
303 >>> @check
305 >>> @check
304 ... def tagscache(server):
306 ... def tagscache(server):
305 ... readchannel(server)
307 ... readchannel(server)
@@ -312,7 +314,7 b' Clean hook cached version'
312 foo
314 foo
313
315
314 >>> import os
316 >>> import os
315 >>> from hgclient import readchannel, runcommand, check
317 >>> from hgclient import check, readchannel, runcommand
316 >>> @check
318 >>> @check
317 ... def setphase(server):
319 ... def setphase(server):
318 ... readchannel(server)
320 ... readchannel(server)
@@ -325,7 +327,7 b' Clean hook cached version'
325 3: public
327 3: public
326
328
327 $ echo a >> a
329 $ echo a >> a
328 >>> from hgclient import readchannel, runcommand, check
330 >>> from hgclient import check, readchannel, runcommand
329 >>> @check
331 >>> @check
330 ... def rollback(server):
332 ... def rollback(server):
331 ... readchannel(server)
333 ... readchannel(server)
@@ -345,7 +347,7 b' Clean hook cached version'
345
347
346
348
347 >>> import os
349 >>> import os
348 >>> from hgclient import readchannel, runcommand, check
350 >>> from hgclient import check, readchannel, runcommand
349 >>> @check
351 >>> @check
350 ... def branch(server):
352 ... def branch(server):
351 ... readchannel(server)
353 ... readchannel(server)
@@ -364,7 +366,7 b' Clean hook cached version'
364
366
365 $ touch .hgignore
367 $ touch .hgignore
366 >>> import os
368 >>> import os
367 >>> from hgclient import readchannel, runcommand, check
369 >>> from hgclient import check, readchannel, runcommand
368 >>> @check
370 >>> @check
369 ... def hgignore(server):
371 ... def hgignore(server):
370 ... readchannel(server)
372 ... readchannel(server)
@@ -387,7 +389,7 b' cache of non-public revisions should be '
387 (issue4855):
389 (issue4855):
388
390
389 >>> import os
391 >>> import os
390 >>> from hgclient import readchannel, runcommand, check
392 >>> from hgclient import check, readchannel, runcommand
391 >>> @check
393 >>> @check
392 ... def phasesetscacheaftercommit(server):
394 ... def phasesetscacheaftercommit(server):
393 ... readchannel(server)
395 ... readchannel(server)
@@ -412,7 +414,7 b' cache of non-public revisions should be '
412
414
413
415
414 >>> import os
416 >>> import os
415 >>> from hgclient import readchannel, runcommand, check
417 >>> from hgclient import check, readchannel, runcommand
416 >>> @check
418 >>> @check
417 ... def phasesetscacheafterstrip(server):
419 ... def phasesetscacheafterstrip(server):
418 ... readchannel(server)
420 ... readchannel(server)
@@ -434,7 +436,7 b' cache of non-public revisions should be '
434 cache of phase roots should be invalidated on strip (issue3827):
436 cache of phase roots should be invalidated on strip (issue3827):
435
437
436 >>> import os
438 >>> import os
437 >>> from hgclient import readchannel, sep, runcommand, check
439 >>> from hgclient import check, readchannel, runcommand, sep
438 >>> @check
440 >>> @check
439 ... def phasecacheafterstrip(server):
441 ... def phasecacheafterstrip(server):
440 ... readchannel(server)
442 ... readchannel(server)
@@ -485,7 +487,7 b' in-memory cache must be reloaded if tran'
485 changelog and manifest would have invalid node:
487 changelog and manifest would have invalid node:
486
488
487 $ echo a >> a
489 $ echo a >> a
488 >>> from hgclient import readchannel, runcommand, check
490 >>> from hgclient import check, readchannel, runcommand
489 >>> @check
491 >>> @check
490 ... def txabort(server):
492 ... def txabort(server):
491 ... readchannel(server)
493 ... readchannel(server)
@@ -511,7 +513,7 b' changelog and manifest would have invali'
511 > EOF
513 > EOF
512
514
513 >>> import os
515 >>> import os
514 >>> from hgclient import readchannel, runcommand, check
516 >>> from hgclient import check, readchannel, runcommand
515 >>> @check
517 >>> @check
516 ... def obsolete(server):
518 ... def obsolete(server):
517 ... readchannel(server)
519 ... readchannel(server)
@@ -560,7 +562,7 b' changelog and manifest would have invali'
560 > EOF
562 > EOF
561
563
562 >>> import os
564 >>> import os
563 >>> from hgclient import readchannel, runcommand, check
565 >>> from hgclient import check, readchannel, runcommand
564 >>> @check
566 >>> @check
565 ... def mqoutsidechanges(server):
567 ... def mqoutsidechanges(server):
566 ... readchannel(server)
568 ... readchannel(server)
@@ -585,7 +587,8 b' changelog and manifest would have invali'
585 foo
587 foo
586
588
587 $ cat <<EOF > dbgui.py
589 $ cat <<EOF > dbgui.py
588 > import os, sys
590 > import os
591 > import sys
589 > from mercurial import commands, registrar
592 > from mercurial import commands, registrar
590 > cmdtable = {}
593 > cmdtable = {}
591 > command = registrar.command(cmdtable)
594 > command = registrar.command(cmdtable)
@@ -609,7 +612,7 b' changelog and manifest would have invali'
609 > dbgui = dbgui.py
612 > dbgui = dbgui.py
610 > EOF
613 > EOF
611
614
612 >>> from hgclient import readchannel, runcommand, check, stringio
615 >>> from hgclient import check, readchannel, runcommand, stringio
613 >>> @check
616 >>> @check
614 ... def getpass(server):
617 ... def getpass(server):
615 ... readchannel(server)
618 ... readchannel(server)
@@ -644,7 +647,7 b' changelog and manifest would have invali'
644 run commandserver in commandserver, which is silly but should work:
647 run commandserver in commandserver, which is silly but should work:
645
648
646 >>> from __future__ import print_function
649 >>> from __future__ import print_function
647 >>> from hgclient import readchannel, runcommand, check, stringio
650 >>> from hgclient import check, readchannel, runcommand, stringio
648 >>> @check
651 >>> @check
649 ... def nested(server):
652 ... def nested(server):
650 ... print('%c, %r' % readchannel(server))
653 ... print('%c, %r' % readchannel(server))
@@ -667,7 +670,7 b' start without repository:'
667 $ cd ..
670 $ cd ..
668
671
669 >>> from __future__ import print_function
672 >>> from __future__ import print_function
670 >>> from hgclient import readchannel, runcommand, check
673 >>> from hgclient import check, readchannel, runcommand
671 >>> @check
674 >>> @check
672 ... def hellomessage(server):
675 ... def hellomessage(server):
673 ... ch, data = readchannel(server)
676 ... ch, data = readchannel(server)
@@ -680,7 +683,7 b' start without repository:'
680 abort: there is no Mercurial repository here (.hg not found)
683 abort: there is no Mercurial repository here (.hg not found)
681 [255]
684 [255]
682
685
683 >>> from hgclient import readchannel, runcommand, check
686 >>> from hgclient import check, readchannel, runcommand
684 >>> @check
687 >>> @check
685 ... def startwithoutrepo(server):
688 ... def startwithoutrepo(server):
686 ... readchannel(server)
689 ... readchannel(server)
@@ -708,7 +711,7 b' unix domain socket:'
708 #if unix-socket unix-permissions
711 #if unix-socket unix-permissions
709
712
710 >>> from __future__ import print_function
713 >>> from __future__ import print_function
711 >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
714 >>> from hgclient import check, readchannel, runcommand, stringio, unixserver
712 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
715 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
713 >>> def hellomessage(conn):
716 >>> def hellomessage(conn):
714 ... ch, data = readchannel(conn)
717 ... ch, data = readchannel(conn)
@@ -760,7 +763,7 b' unix domain socket:'
760 > log = inexistent/path.log
763 > log = inexistent/path.log
761 > EOF
764 > EOF
762 >>> from __future__ import print_function
765 >>> from __future__ import print_function
763 >>> from hgclient import unixserver, readchannel, check
766 >>> from hgclient import check, readchannel, unixserver
764 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
767 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
765 >>> def earlycrash(conn):
768 >>> def earlycrash(conn):
766 ... while True:
769 ... while True:
@@ -837,7 +840,7 b' cases.'
837
840
838 (failure before finalization)
841 (failure before finalization)
839
842
840 >>> from hgclient import readchannel, runcommand, check
843 >>> from hgclient import check, readchannel, runcommand
841 >>> @check
844 >>> @check
842 ... def abort(server):
845 ... def abort(server):
843 ... readchannel(server)
846 ... readchannel(server)
@@ -856,7 +859,7 b' cases.'
856
859
857 (failure after finalization)
860 (failure after finalization)
858
861
859 >>> from hgclient import readchannel, runcommand, check
862 >>> from hgclient import check, readchannel, runcommand
860 >>> @check
863 >>> @check
861 ... def abort(server):
864 ... def abort(server):
862 ... readchannel(server)
865 ... readchannel(server)
@@ -881,7 +884,7 b' cases.'
881
884
882 (failure before finalization)
885 (failure before finalization)
883
886
884 >>> from hgclient import readchannel, runcommand, check
887 >>> from hgclient import check, readchannel, runcommand
885 >>> @check
888 >>> @check
886 ... def abort(server):
889 ... def abort(server):
887 ... readchannel(server)
890 ... readchannel(server)
@@ -901,7 +904,7 b' cases.'
901
904
902 (failure after finalization)
905 (failure after finalization)
903
906
904 >>> from hgclient import readchannel, runcommand, check
907 >>> from hgclient import check, readchannel, runcommand
905 >>> @check
908 >>> @check
906 ... def abort(server):
909 ... def abort(server):
907 ... readchannel(server)
910 ... readchannel(server)
@@ -951,7 +954,7 b' try trivial merge after update: cache of'
951 and the merge should fail (issue5628)
954 and the merge should fail (issue5628)
952
955
953 $ hg up -q null
956 $ hg up -q null
954 >>> from hgclient import readchannel, runcommand, check
957 >>> from hgclient import check, readchannel, runcommand
955 >>> @check
958 >>> @check
956 ... def merge(server):
959 ... def merge(server):
957 ... readchannel(server)
960 ... readchannel(server)
@@ -972,7 +975,7 b' symlinks:'
972
975
973 $ hg up -qC 0
976 $ hg up -qC 0
974 $ touch ../merge-symlink-out/poisoned
977 $ touch ../merge-symlink-out/poisoned
975 >>> from hgclient import readchannel, runcommand, check
978 >>> from hgclient import check, readchannel, runcommand
976 >>> @check
979 >>> @check
977 ... def files(server):
980 ... def files(server):
978 ... readchannel(server)
981 ... readchannel(server)
General Comments 0
You need to be logged in to leave comments. Login now