Patchwork [1,of,9] test-batching: stop direct symbol import of mercurial modules

login
register
mail settings
Submitter Yuya Nishihara
Date April 5, 2016, 4:05 p.m.
Message ID <084a6924ea81ee540555.1459872309@mimosa>
Download mbox | patch
Permalink /patch/14372/
State Accepted
Headers show

Comments

Yuya Nishihara - April 5, 2016, 4:05 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1459865413 -32400
#      Tue Apr 05 23:10:13 2016 +0900
# Node ID 084a6924ea81ee540555e35a45ed67fa64020f78
# Parent  9b3fac6b21d7f3b6048a912088973300793f1049
test-batching: stop direct symbol import of mercurial modules

Silences future errors reported by import-checker.py.
timeless - April 5, 2016, 5:52 p.m.
I thought we used "tests" as the topic for things in tests.
On Apr 5, 2016 12:05 PM, "Yuya Nishihara" <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1459865413 -32400
> #      Tue Apr 05 23:10:13 2016 +0900
> # Node ID 084a6924ea81ee540555e35a45ed67fa64020f78
> # Parent  9b3fac6b21d7f3b6048a912088973300793f1049
> test-batching: stop direct symbol import of mercurial modules
>
> Silences future errors reported by import-checker.py.
>
> diff --git a/tests/test-batching.py b/tests/test-batching.py
> --- a/tests/test-batching.py
> +++ b/tests/test-batching.py
> @@ -6,13 +6,10 @@
>  # GNU General Public License version 2 or any later version.
>
>  from __future__ import absolute_import, print_function
> -from mercurial.peer import (
> -    localbatch,
> -    batchable,
> -    future,
> -)
> -from mercurial.wireproto import (
> -    remotebatch,
> +
> +from mercurial import (
> +    peer,
> +    wireproto,
>  )
>
>  # equivalent of repo.repository
> @@ -32,7 +29,7 @@ class localthing(thing):
>          return "Hello, %s" % name
>      def batch(self):
>          '''Support for local batching.'''
> -        return localbatch(self)
> +        return peer.localbatch(self)
>
>  # usage of "thing" interface
>  def use(it):
> @@ -152,20 +149,20 @@ class remotething(thing):
>          return res.split(';')
>
>      def batch(self):
> -        return remotebatch(self)
> +        return wireproto.remotebatch(self)
>
> -    @batchable
> +    @peer.batchable
>      def foo(self, one, two=None):
>          if not one:
>              yield "Nope", None
>          encargs = [('one', mangle(one),), ('two', mangle(two),)]
> -        encresref = future()
> +        encresref = peer.future()
>          yield encargs, encresref
>          yield unmangle(encresref.value)
>
> -    @batchable
> +    @peer.batchable
>      def bar(self, b, a):
> -        encresref = future()
> +        encresref = peer.future()
>          yield [('b', mangle(b),), ('a', mangle(a),)], encresref
>          yield unmangle(encresref.value)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/tests/test-batching.py b/tests/test-batching.py
--- a/tests/test-batching.py
+++ b/tests/test-batching.py
@@ -6,13 +6,10 @@ 
 # GNU General Public License version 2 or any later version.
 
 from __future__ import absolute_import, print_function
-from mercurial.peer import (
-    localbatch,
-    batchable,
-    future,
-)
-from mercurial.wireproto import (
-    remotebatch,
+
+from mercurial import (
+    peer,
+    wireproto,
 )
 
 # equivalent of repo.repository
@@ -32,7 +29,7 @@  class localthing(thing):
         return "Hello, %s" % name
     def batch(self):
         '''Support for local batching.'''
-        return localbatch(self)
+        return peer.localbatch(self)
 
 # usage of "thing" interface
 def use(it):
@@ -152,20 +149,20 @@  class remotething(thing):
         return res.split(';')
 
     def batch(self):
-        return remotebatch(self)
+        return wireproto.remotebatch(self)
 
-    @batchable
+    @peer.batchable
     def foo(self, one, two=None):
         if not one:
             yield "Nope", None
         encargs = [('one', mangle(one),), ('two', mangle(two),)]
-        encresref = future()
+        encresref = peer.future()
         yield encargs, encresref
         yield unmangle(encresref.value)
 
-    @batchable
+    @peer.batchable
     def bar(self, b, a):
-        encresref = future()
+        encresref = peer.future()
         yield [('b', mangle(b),), ('a', mangle(a),)], encresref
         yield unmangle(encresref.value)