aio-libs / aiozmq

Asyncio (pep 3156) integration with ZeroMQ
aiozmq.readthedocs.org
BSD 2-Clause "Simplified" License
422 stars 56 forks source link

More convenient create_zmq_stream() and create_zmq_connection() #114

Closed amezin closed 3 years ago

amezin commented 7 years ago

When create_zmq_stream() is called with non-zmq event loop, current API doesn't allow the user to specify ZMQ context. If the user wants to use custom ZMQ context, not the one returned by zmq.Context.instance() (useful for tests, for example), his only possible choice is to create the socket manually:

sock = ctx.socket(zmq.REQ)

and call create_zmq_stream() with it:

stream = create_zmq_stream(zmq.REQ, zmq_sock=sock)

Note that it is required to specify zmq.REQ twice.

I propose two changes that solve this problem two different ways:

codecov-io commented 7 years ago

Codecov Report

Merging #114 into master will decrease coverage by 0.16%. The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
- Coverage   90.15%   89.99%   -0.17%     
==========================================
  Files          17       17              
  Lines        1676     1659      -17     
  Branches      271      265       -6     
==========================================
- Hits         1511     1493      -18     
  Misses        142      142              
- Partials       23       24       +1
Impacted Files Coverage Δ
aiozmq/stream.py 84.04% <100%> (ø) :arrow_up:
aiozmq/core.py 92.7% <95%> (-0.39%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 13d8f4e...82f5193. Read the comment docs.

CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

JelleZijlstra commented 3 years ago

Closing as stale, sorry