Skip to content

Various simplifications #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def event_loop(request):
event_loop = policy.new_event_loop()
policy.set_event_loop(event_loop)

def _close():
event_loop.close()

request.addfinalizer(_close)
request.addfinalizer(event_loop.close)
return event_loop


Expand All @@ -90,5 +87,4 @@ def unused_tcp_port():
"""Find an unused localhost TCP port from 1024-65535 and return it."""
with closing(socket.socket()) as sock:
sock.bind(('127.0.0.1', 0))
port = sock.getsockname()[1]
return port
return sock.getsockname()[1]