Skip to content

Commit

Permalink
eventlet: provide additional socket properties
Browse files Browse the repository at this point in the history
Bug-Url: svinota#1225
  • Loading branch information
svinota committed Jan 10, 2025
1 parent f1c598d commit 434db0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyroute2/config/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def fileno(self):
def dup(self):
return self.__class__(_sock=self._sock.dup())

@property
def type(self):
return self._sock.type


class _MpConnection(object):
"""Highly limited multiprocessing.Connection alternative"""
Expand Down
1 change: 1 addition & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build
twine
flake8
eventlet
netaddr
pytest
pytest-cov
Expand Down
11 changes: 11 additions & 0 deletions tests/test_neutron/test_ip_lib.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from inspect import signature

import eventlet
import pytest

import pyroute2
from pyroute2 import netlink, netns
from pyroute2.config.eventlet import eventlet_config
from pyroute2.netlink import exceptions, rtnl
from pyroute2.netlink.rtnl import ifinfmsg, ndmsg

eventlet.monkey_patch()
eventlet_config()


def parameters(func):
try:
Expand Down Expand Up @@ -40,3 +45,9 @@ def test_imports():
64: 'noarp',
128: 'permanent',
}


def test_dump():
with pyroute2.IPRoute() as ipr:
assert len(tuple(ipr.route('dump'))) > 0
assert len(tuple(ipr.link('dump'))) > 0

0 comments on commit 434db0b

Please sign in to comment.