support/testing: add new test for python-sdbus-networkmanager

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Raphaël Mélotte
2024-07-05 11:14:09 +02:00
committed by Yann E. MORIN
parent 00514d75e0
commit 2223d81bd8
3 changed files with 37 additions and 0 deletions

View File

@@ -2766,11 +2766,13 @@ F: support/testing/tests/package/sample_python_pymupdf.py
F: support/testing/tests/package/sample_python_rsa.py
F: support/testing/tests/package/sample_python_s3transfer.py
F: support/testing/tests/package/sample_python_sdbus.py
F: support/testing/tests/package/sample_python_sdbus_networkmanager.py
F: support/testing/tests/package/test_python_jmespath.py
F: support/testing/tests/package/test_python_pymupdf.py
F: support/testing/tests/package/test_python_rsa.py
F: support/testing/tests/package/test_python_s3transfer.py
F: support/testing/tests/package/test_python_sdbus.py
F: support/testing/tests/package/test_python_sdbus_networkmanager.py
N: Raphael Pavlidis <raphael.pavlidis@gmail.com>
F: package/nvidia-persistenced/

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import sdbus
from sdbus_block.networkmanager import (
DeviceType,
NetworkManager,
NetworkDeviceGeneric
)
sdbus.set_default_bus(sdbus.sd_bus_open_system())
nm = NetworkManager()
devices = [NetworkDeviceGeneric(d) for d in nm.get_devices()]
print([d.interface for d in devices])
assert devices
# Check that we found at least the loopback interface:
assert [dev for dev in devices if dev.device_type == DeviceType.LOOPBACK]

View File

@@ -0,0 +1,15 @@
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy3SdbusNetworkmanager(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_INIT_SYSTEMD=y
BR2_PACKAGE_NETWORK_MANAGER=y
BR2_PACKAGE_PYTHON_SDBUS_NETWORKMANAGER=y
"""
sample_scripts = ["tests/package/sample_python_sdbus_networkmanager.py"]
timeout = 30