Metadata-Version: 2.4
Name: pytest-bluezenv
Version: 0.1.6
Summary: pytest BlueZ environment plugin
Author-Email: Pauli Virtanen <pav@iki.fi>
License-Expression: GPL-2.0-or-later
License-File: LICENSE.txt
License-File: subprojects/bluez/COPYING
License-File: subprojects/bluez/COPYING.LIB
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Project-URL: homepage, https://github.com/pv/pytest-bluezenv
Project-URL: documentation, https://pv.github.io/pytest-bluezenv/
Requires-Python: >=3.9
Requires-Dist: pytest>=8
Requires-Dist: pexpect
Requires-Dist: dbus-python
Requires-Dist: PyGObject>=3.40
Provides-Extra: docs
Requires-Dist: Sphinx; extra == "docs"
Requires-Dist: pydata-sphinx-theme; extra == "docs"
Description-Content-Type: text/x-rst

===============
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.
