A pytest plugin to manage interfacing with libiio contexts
pytest-libiio is pytest plugin to manage interfacing with libiio contexts. This plugin is handy for leveraging the zeroconf features of libiio to find, filter, and map libiio contexts to tests. It was created for pyadi-iio testing but is used in other applications that need an organized way to handle libiio contexts without hardcoding URIs or lots of boilerplate code.
Requirements
libiio and pylibiio
pytest
pyyaml
Optional for emulation support:
Optional for SSH telemetry collection:
paramiko (or install with pip install pytest-libiio[ssh])
For development the following are also needed:
nox
pytest-mock
pre-commit
ruff
Installation
You can install “pytest-libiio” via pip from PyPI:
$ pip install pytest-libiio
Usage
The plugin exposes three pytest fixtures — iio_uri, single_ctx_desc, and context_desc — plus an iio_hardware marker that filters tests by detected hardware. The full reference and scenario walkthroughs (emulation, attribute coverage, telemetry, xdist) live in the hosted documentation.
Quickstart — get a URI for a marked board and open the context:
import iio
import pytest
@pytest.mark.iio_hardware("pluto")
def test_pluto(iio_uri):
ctx = iio.Context(iio_uri)
assert ctx.find_device("ad9361-phy") is not None
Fan out across every matching board with context_desc:
import iio
import pytest
@pytest.mark.iio_hardware(["pluto", "adrv9361", "fmcomms2"])
def test_all_matching_boards(context_desc):
for ctx_desc in context_desc:
ctx = iio.Context(ctx_desc["uri"])
...
Run against the bundled ADI hardware map so the marker names resolve:
pytest --adi-hw-map
Contributing
Contributions are very welcome. Tests run via nox (nox -s tests); please ensure coverage at least stays the same before submitting a pull request.
License
Distributed under the terms of the BSD-3 license, “pytest-libiio” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Release files for pytest-libiio 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_libiio-0.2.0.tar.gz | 1.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_libiio-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / pytest_libiio-0.2.0.tar.gz
| Download URL | pytest_libiio-0.2.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7ee6d572b8471369c817709bc296aab6735f0ebaec63ca6b41d359eca5f5c21
|
|
BLAKE2b-256 checksum How to use checksums |
b9e5fd629a0f487604a00e52978d80186f3e03f8229544412ec815d70af91592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / pytest_libiio-0.2.0-py3-none-any.whl
| Download URL | pytest_libiio-0.2.0-py3-none-any.whl |
|---|---|
| Size | 112.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bbac566bb9a011c755dd8bcc504a2512f44de1c29e4b2bb98500ba64d6946c7
|
|
BLAKE2b-256 checksum How to use checksums |
19472f22267459793e97c80bcef6b1201c1c066b467ae0b7af0474daada5b71e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|