Skip to content

Commit

Permalink
Support Autorest.Python 3.x LRO leak (#42)
Browse files Browse the repository at this point in the history
* Support Autorest.Python 3.x LRO leak

* PyLint happyness
  • Loading branch information
lmazuel authored Apr 19, 2018
1 parent c4f01be commit 23b537c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/azure_devtools/scenario_tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ def setUp(self):

def tearDown(self):
os.environ = self.original_env
# Autorest.Python 2.x
assert not [t for t in threading.enumerate() if t.name.startswith("AzureOperationPoller")], \
"You need to call 'result' or 'wait' on all AzureOperationPoller you have created"
# Autorest.Python 3.x
assert not [t for t in threading.enumerate() if t.name.startswith("LROPoller")], \
"You need to call 'result' or 'wait' on all LROPoller you have created"

def _process_request_recording(self, request):
if self.disable_recording:
Expand Down Expand Up @@ -190,7 +194,7 @@ def _process_response_recording(self, response):
@classmethod
def _custom_request_query_matcher(cls, r1, r2):
""" Ensure method, path, and query parameters match. """
from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=import-error
from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=import-error,relative-import

url1 = urlparse(r1.uri)
url2 = urlparse(r2.uri)
Expand Down
2 changes: 1 addition & 1 deletion src/azure_devtools/scenario_tests/preparers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def remove_resource_with_record_override(self, name, **kwargs):
class SingleValueReplacer(RecordingProcessor):
# pylint: disable=no-member
def process_request(self, request):
from six.moves.urllib_parse import quote_plus # pylint: disable=import-error
from six.moves.urllib_parse import quote_plus # pylint: disable=import-error,relative-import
if self.random_name in request.uri:
request.uri = request.uri.replace(self.random_name, self.moniker)
elif quote_plus(self.random_name) in request.uri:
Expand Down

0 comments on commit 23b537c

Please sign in to comment.