https://github.com/pv/pytest-bluezenv
Testing BlueZ and kernel using multiple virtual machine environments
https://github.com/pv/pytest-bluezenv
bluetooth linux python testing
Last synced: 23 days ago
JSON representation
Testing BlueZ and kernel using multiple virtual machine environments
- Host: GitHub
- URL: https://github.com/pv/pytest-bluezenv
- Owner: pv
- License: other
- Created: 2026-05-06T18:17:43.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-07T16:55:08.000Z (28 days ago)
- Last Synced: 2026-06-07T18:26:15.332Z (28 days ago)
- Topics: bluetooth, linux, python, testing
- Language: Python
- Homepage: https://pv.github.io/pytest-bluezenv/
- Size: 3.67 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
===============
pytest-bluezenv
===============
**pytest-bluezenv** Pytest plugin is used for functional testing of
BlueZ and kernel using multiple virtual machine environments,
connected by real or virtual controllers.
- Source code: https://github.com/pv/pytest-bluezenv/
- Documentation: https://pv.github.io/pytest-bluezenv/
- PyPi: https://pypi.org/project/pytest-bluezenv/
Example
-------
.. code-block:: python
from pytest_bluezenv import host_config, Bluetoothd, Bluetoothctl
@host_config(
[Bluetoothd(), Bluetoothctl()],
[Bluetoothd(), Bluetoothctl()],
)
def test_bluetoothctl_pair(hosts):
host0, host1 = hosts
host0.bluetoothctl.send("scan on\n")
host0.bluetoothctl.expect(f"Controller {host0.bdaddr.upper()} Discovering: yes")
host1.bluetoothctl.send("pairable on\n")
host1.bluetoothctl.expect("Changing pairable on succeeded")
host1.bluetoothctl.send("discoverable on\n")
host1.bluetoothctl.expect(f"Controller {host1.bdaddr.upper()} Discoverable: yes")
host0.bluetoothctl.expect(f"Device {host1.bdaddr.upper()}")
host0.bluetoothctl.send(f"pair {host1.bdaddr}\n")
idx, m = host0.bluetoothctl.expect(r"Confirm passkey (\d+).*:")
key = m[0].decode("utf-8")
host1.bluetoothctl.expect(f"Confirm passkey {key}")
host0.bluetoothctl.send("yes\n")
host1.bluetoothctl.send("yes\n")
host0.bluetoothctl.expect("Pairing successful")
The test declares a VM setup with two Qemu instances, where both hosts
run bluetoothd and start a bluetoothctl process. The Qemu instances
have `btvirt` virtual BT controllers and can see each other.