Patchwork [9,of,9] tests: update test-commandserver to pass our import checker

login
register
mail settings
Submitter Augie Fackler
Date Aug. 24, 2017, 2:33 p.m.
Message ID <9ddbab8e7b33de19eca2.1503585210@imladris.local>
Download mbox | patch
Permalink /patch/23301/
State Accepted
Headers show

Comments

Augie Fackler - Aug. 24, 2017, 2:33 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1503426385 14400
#      Tue Aug 22 14:26:25 2017 -0400
# Node ID 9ddbab8e7b33de19eca201e68c188bec23e38d32
# Parent  f55070ce9b76fbd05457df39563010fc2a3918ce
tests: update test-commandserver to pass our import checker

Patch

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -13,8 +13,10 @@  typical client does not want echo-back m
   $ hg init repo
   $ cd repo
 
-  >>> from __future__ import print_function
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from __future__ import absolute_import, print_function
+  >>> import os
+  >>> import sys
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def hellomessage(server):
   ...     ch, data = readchannel(server)
@@ -32,7 +34,7 @@  typical client does not want echo-back m
   ...     server.stdin.write('unknowncommand\n')
   abort: unknown command unknowncommand
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def checkruncommand(server):
   ...     # hello block
@@ -91,7 +93,7 @@  typical client does not want echo-back m
   abort: unknown revision 'unknown'!
    [255]
 
-  >>> from hgclient import readchannel, check
+  >>> from hgclient import check, readchannel
   >>> @check
   ... def inputeof(server):
   ...     readchannel(server)
@@ -103,7 +105,7 @@  typical client does not want echo-back m
   ...     print('server exit code =', server.wait())
   server exit code = 1
 
-  >>> from hgclient import readchannel, runcommand, check, stringio
+  >>> from hgclient import check, readchannel, runcommand, stringio
   >>> @check
   ... def serverinput(server):
   ...     readchannel(server)
@@ -138,7 +140,7 @@  typical client does not want echo-back m
 check that "histedit --commands=-" can read rules from the input channel:
 
   >>> import cStringIO
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def serverinput(server):
   ...     readchannel(server)
@@ -152,7 +154,7 @@  check that --cwd doesn't persist between
 
   $ mkdir foo
   $ touch foo/bar
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def cwd(server):
   ...     readchannel(server)
@@ -173,7 +175,7 @@  check that local configs for the cached 
   > foo = bar
   > EOF
 
-  >>> from hgclient import readchannel, sep, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand, sep
   >>> @check
   ... def localhgrc(server):
   ...     readchannel(server)
@@ -223,7 +225,7 @@  check that local configs for the cached 
   >     print('now try to read something: %r' % sys.stdin.read())
   > EOF
 
-  >>> from hgclient import readchannel, runcommand, check, stringio
+  >>> from hgclient import check, readchannel, runcommand, stringio
   >>> @check
   ... def hookoutput(server):
   ...     readchannel(server)
@@ -240,7 +242,7 @@  Clean hook cached version
 
   $ echo a >> a
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def outsidechanges(server):
   ...     readchannel(server)
@@ -260,7 +262,7 @@  Clean hook cached version
   *** runcommand status
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def bookmarks(server):
   ...     readchannel(server)
@@ -299,7 +301,7 @@  Clean hook cached version
   
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def tagscache(server):
   ...     readchannel(server)
@@ -312,7 +314,7 @@  Clean hook cached version
   foo
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def setphase(server):
   ...     readchannel(server)
@@ -325,7 +327,7 @@  Clean hook cached version
   3: public
 
   $ echo a >> a
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def rollback(server):
   ...     readchannel(server)
@@ -345,7 +347,7 @@  Clean hook cached version
   
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def branch(server):
   ...     readchannel(server)
@@ -364,7 +366,7 @@  Clean hook cached version
 
   $ touch .hgignore
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def hgignore(server):
   ...     readchannel(server)
@@ -387,7 +389,7 @@  cache of non-public revisions should be 
 (issue4855):
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def phasesetscacheaftercommit(server):
   ...     readchannel(server)
@@ -412,7 +414,7 @@  cache of non-public revisions should be 
   
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def phasesetscacheafterstrip(server):
   ...     readchannel(server)
@@ -434,7 +436,7 @@  cache of non-public revisions should be 
 cache of phase roots should be invalidated on strip (issue3827):
 
   >>> import os
-  >>> from hgclient import readchannel, sep, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand, sep
   >>> @check
   ... def phasecacheafterstrip(server):
   ...     readchannel(server)
@@ -485,7 +487,7 @@  in-memory cache must be reloaded if tran
 changelog and manifest would have invalid node:
 
   $ echo a >> a
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def txabort(server):
   ...     readchannel(server)
@@ -511,7 +513,7 @@  changelog and manifest would have invali
   > EOF
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def obsolete(server):
   ...     readchannel(server)
@@ -560,7 +562,7 @@  changelog and manifest would have invali
   > EOF
 
   >>> import os
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def mqoutsidechanges(server):
   ...     readchannel(server)
@@ -585,7 +587,8 @@  changelog and manifest would have invali
   foo
 
   $ cat <<EOF > dbgui.py
-  > import os, sys
+  > import os
+  > import sys
   > from mercurial import commands, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
@@ -609,7 +612,7 @@  changelog and manifest would have invali
   > dbgui = dbgui.py
   > EOF
 
-  >>> from hgclient import readchannel, runcommand, check, stringio
+  >>> from hgclient import check, readchannel, runcommand, stringio
   >>> @check
   ... def getpass(server):
   ...     readchannel(server)
@@ -644,7 +647,7 @@  changelog and manifest would have invali
 run commandserver in commandserver, which is silly but should work:
 
   >>> from __future__ import print_function
-  >>> from hgclient import readchannel, runcommand, check, stringio
+  >>> from hgclient import check, readchannel, runcommand, stringio
   >>> @check
   ... def nested(server):
   ...     print('%c, %r' % readchannel(server))
@@ -667,7 +670,7 @@  start without repository:
   $ cd ..
 
   >>> from __future__ import print_function
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def hellomessage(server):
   ...     ch, data = readchannel(server)
@@ -680,7 +683,7 @@  start without repository:
   abort: there is no Mercurial repository here (.hg not found)
    [255]
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def startwithoutrepo(server):
   ...     readchannel(server)
@@ -708,7 +711,7 @@  unix domain socket:
 #if unix-socket unix-permissions
 
   >>> from __future__ import print_function
-  >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
+  >>> from hgclient import check, readchannel, runcommand, stringio, unixserver
   >>> server = unixserver('.hg/server.sock', '.hg/server.log')
   >>> def hellomessage(conn):
   ...     ch, data = readchannel(conn)
@@ -760,7 +763,7 @@  unix domain socket:
   > log = inexistent/path.log
   > EOF
   >>> from __future__ import print_function
-  >>> from hgclient import unixserver, readchannel, check
+  >>> from hgclient import check, readchannel, unixserver
   >>> server = unixserver('.hg/server.sock', '.hg/server.log')
   >>> def earlycrash(conn):
   ...     while True:
@@ -837,7 +840,7 @@  cases.
 
 (failure before finalization)
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def abort(server):
   ...     readchannel(server)
@@ -856,7 +859,7 @@  cases.
 
 (failure after finalization)
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def abort(server):
   ...     readchannel(server)
@@ -881,7 +884,7 @@  cases.
 
 (failure before finalization)
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def abort(server):
   ...     readchannel(server)
@@ -901,7 +904,7 @@  cases.
 
 (failure after finalization)
 
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def abort(server):
   ...     readchannel(server)
@@ -951,7 +954,7 @@  try trivial merge after update: cache of
 and the merge should fail (issue5628)
 
   $ hg up -q null
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def merge(server):
   ...     readchannel(server)
@@ -972,7 +975,7 @@  symlinks:
 
   $ hg up -qC 0
   $ touch ../merge-symlink-out/poisoned
-  >>> from hgclient import readchannel, runcommand, check
+  >>> from hgclient import check, readchannel, runcommand
   >>> @check
   ... def files(server):
   ...     readchannel(server)