mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-22 08:52:29 -09:00
support/testing: python-pyroute2: new runtime test
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> [Julien: - reword commit log title - replace python '%' formatting with '+' concatenation - remove IP address assertion in test controller as it is already in sample script ] Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
786557d859
commit
7b3bf7b29c
16
support/testing/tests/package/sample_python_pyroute2.py
Normal file
16
support/testing/tests/package/sample_python_pyroute2.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from pyroute2 import IPRoute
|
||||
|
||||
|
||||
def test_ipr():
|
||||
with IPRoute() as ipr:
|
||||
lo = ipr.link('get', ifname='lo')[0]
|
||||
a = [
|
||||
dict(a['attrs'])['IFA_ADDRESS']
|
||||
for a in ipr.get_addr(index=lo['index'])
|
||||
]
|
||||
print(repr(a))
|
||||
assert '127.0.0.1' in a
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_ipr()
|
||||
Reference in New Issue
Block a user