1414
1515"""Shared testing utilities."""
1616
17+
18+ # Avoid the grpc and google.cloud.grpc collision.
1719from __future__ import absolute_import
1820
1921
2022class _Monkey (object ):
21- """Context -manager for replacing module names in the scope of a test."""
23+ # context -manager for replacing module names in the scope of a test.
2224
2325 def __init__ (self , module , ** kw ):
2426 self .module = module
25- if not kw : # pragma: NO COVER
27+ if len ( kw ) == 0 : # pragma: NO COVER
2628 raise ValueError ('_Monkey was used with nothing to monkey-patch' )
2729 self .to_restore = {key : getattr (module , key ) for key in kw }
2830 for key , value in kw .items ():
@@ -66,12 +68,8 @@ def _tempdir_mgr():
6668 return _tempdir_mgr
6769
6870
69- # pylint: disable=invalid-name
70- # Retain _tempdir as a constant for backwards compatibility despite
71- # being an invalid name.
7271_tempdir = _tempdir_maker ()
7372del _tempdir_maker
74- # pylint: enable=invalid-name
7573
7674
7775class _GAXBaseAPI (object ):
@@ -81,8 +79,7 @@ class _GAXBaseAPI(object):
8179 def __init__ (self , ** kw ):
8280 self .__dict__ .update (kw )
8381
84- @staticmethod
85- def _make_grpc_error (status_code , trailing = None ):
82+ def _make_grpc_error (self , status_code , trailing = None ):
8683 from grpc ._channel import _RPCState
8784 from google .cloud .exceptions import GrpcRendezvous
8885
@@ -114,7 +111,6 @@ def __init__(self, *pages, **kwargs):
114111 self .page_token = kwargs .get ('page_token' )
115112
116113 def next (self ):
117- """Iterate to the next page."""
118114 import six
119115 return six .next (self ._pages )
120116
0 commit comments