A pytest plugin for testing libiio based devices
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_libiio-0.2.0.tar.gz.
File metadata
- Download URL: pytest_libiio-0.2.0.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ee6d572b8471369c817709bc296aab6735f0ebaec63ca6b41d359eca5f5c21
|
|
| MD5 |
eb71af9177bb1a355edac2551b71b4a9
|
|
| BLAKE2b-256 |
b9e5fd629a0f487604a00e52978d80186f3e03f8229544412ec815d70af91592
|
File details
Details for the file pytest_libiio-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pytest_libiio-0.2.0-py3-none-any.whl
- Upload date:
- Size: 112.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bbac566bb9a011c755dd8bcc504a2512f44de1c29e4b2bb98500ba64d6946c7
|
|
| MD5 |
dc61e6b3db80708035d448bd91bce262
|
|
| BLAKE2b-256 |
19472f22267459793e97c80bcef6b1201c1c066b467ae0b7af0474daada5b71e
|