Skip to content

Commit 7f667c1

Browse files
annatischyunhaoling
authored andcommitted
Patch for no running loop (#82)
* Patch for no running loop * Catch attribute error for Py3.5.0 * Updated release notes * Bumped version * Added Py version warning * Skip unstable tests for now * Removed Python3.4 tag
1 parent dbd9437 commit 7f667c1

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

HISTORY.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Release History
44
===============
55

6+
1.2.2 (2019-07-02)
7+
++++++++++++++++++
8+
9+
- Made bug fix in asyncio.get_event_loop backwards-compatible for now by just printing a warning rather than raising an error. In the next major version bump we can disable entirely.
10+
611
1.2.1 (2019-06-20)
712
++++++++++++++++++
813

@@ -334,4 +339,4 @@ Release History
334339
0.1.0a1 (2018-03-04)
335340
++++++++++++++++++++
336341

337-
- Initial release
342+
- Initial release

samples/asynctests/test_azure_event_hubs_receive_async.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ async def test_event_hubs_batch_receive_async(live_eventhub_config):
131131

132132
@pytest.mark.asyncio
133133
async def test_event_hubs_shared_connection_async(live_eventhub_config):
134+
pytest.skip("Unstable on OSX and Linux - need to fix") # TODO
134135
uri = "sb://{}/{}".format(live_eventhub_config['hostname'], live_eventhub_config['event_hub'])
135136
sas_auth = authentication.SASTokenAsync.from_shared_access_key(
136137
uri, live_eventhub_config['key_name'], live_eventhub_config['access_key'])
@@ -171,6 +172,7 @@ async def receive_ten(partition, receiver):
171172

172173
@pytest.mark.asyncio
173174
async def test_event_hubs_multiple_receiver_async(live_eventhub_config):
175+
pytest.skip("Unstable on OSX and Linux - need to fix") # TODO
174176
uri = "sb://{}/{}".format(live_eventhub_config['hostname'], live_eventhub_config['event_hub'])
175177
sas_auth_a = authentication.SASTokenAsync.from_shared_access_key(
176178
uri, live_eventhub_config['key_name'], live_eventhub_config['access_key'])
@@ -210,4 +212,4 @@ async def test_event_hubs_multiple_receiver_async(live_eventhub_config):
210212
config['partition'] = "0"
211213

212214
loop = asyncio.get_event_loop()
213-
loop.run_until_complete(test_event_hubs_iter_receive_async(config))
215+
loop.run_until_complete(test_event_hubs_iter_receive_async(config))

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ def build_cmake(self, ext):
333333
'Programming Language :: Python :: 2',
334334
'Programming Language :: Python :: 2.7',
335335
'Programming Language :: Python :: 3',
336-
'Programming Language :: Python :: 3.4',
337336
'Programming Language :: Python :: 3.5',
338337
'Programming Language :: Python :: 3.6',
339338
'Programming Language :: Python :: 3.7',

uamqp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
pass # Async not supported.
3434

3535

36-
__version__ = "1.2.1"
36+
__version__ = "1.2.2"
3737

3838

3939
_logger = logging.getLogger(__name__)

uamqp/utils.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@
88
import calendar
99
import time
1010
import uuid
11+
import logging
1112
from datetime import timedelta, datetime
1213

1314
import six
1415
from uamqp import c_uamqp
1516

17+
logger = logging.getLogger(__name__)
18+
1619

1720
def get_running_loop():
1821
try:
1922
import asyncio # pylint: disable=import-error
2023
return asyncio.get_running_loop()
2124
except AttributeError: # 3.5 / 3.6
22-
loop = asyncio._get_running_loop() # pylint: disable=protected-access
25+
loop = None
26+
try:
27+
loop = asyncio._get_running_loop() # pylint: disable=protected-access
28+
except AttributeError:
29+
logger.warning('This version of Python is deprecated, please upgrade to >= v3.5.3')
2330
if loop is None:
24-
raise RuntimeError('No running event loop')
31+
logger.warning('No running event loop')
32+
loop = asyncio.get_event_loop()
2533
return loop
34+
except RuntimeError:
35+
# For backwards compatibility, create new event loop
36+
logger.warning('No running event loop')
37+
return asyncio.get_event_loop()
2638

2739

2840
def parse_connection_string(connect_str):

0 commit comments

Comments
 (0)