Skip to main content

pytest-libiio

PyPI version Python versions See Build Status on GitHub Actions See Coverage Status on Coveralls Documentation Build Status

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

Track how much of each context’s IIO attributes your tests exercise with --iio-coverage:

pytest --adi-hw-map --iio-coverage

This records every device- and channel-level attribute read or written, then writes a per-context JSON file plus an aggregate Markdown report. To keep noise (diagnostic devices, unsupported attributes, etc.) out of the tally, add a per-hardware ignore: section to the hardware map listing devices, channels, or attributes to exclude (glob patterns supported):

pluto:
  - ad9361-phy
  - cf-ad9361-lpc,2
  - ignore:
      devices: [xadc]
      attributes:
        - {device: ad9361-phy, name: calib_mode_available}

Ignored items are dropped from both the access counts and the coverage denominator. See the coverage tracking docs for the full schema.

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.

Metadata

Release files for pytest-libiio 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-libiio 0.3.0
File Size Uploaded Provenance Actions
pytest_libiio-0.3.0.tar.gz 1.9 MB Without provenance Details for pytest_libiio-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-libiio 0.3.0
File Interpreter ABI Platform Actions
pytest_libiio-0.3.0-py3-none-any.whl Python 3 none any Details for pytest_libiio-0.3.0-py3-none-any.whl

Total release size: 2.0 MB

Release files / pytest_libiio-0.3.0.tar.gz

Download URL pytest_libiio-0.3.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
44c9195ef3de2ede6f4ed464aad5364ae8c1ca1de44420b938184388461ca8ae
BLAKE2b-256 checksum
How to use checksums
c23157ef424de87ac088fd9a22dd0b01e92d41c0f5092bdc8435504c860b208a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pytest_libiio-0.3.0-py3-none-any.whl

Download URL pytest_libiio-0.3.0-py3-none-any.whl
Size 114.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b46f1b98d5bba1fb1c21b080a2d8040446d6f89a887cff98de0ec59b1501291
BLAKE2b-256 checksum
How to use checksums
0ccee39038c3af512e84f37bfa7b2ab0d2da7c1d2517ad1e2d8f033801d47892
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pytest-libiio 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page