Skip to main content

A pytest plugin for testing libiio based devices

Project description

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_libiio-0.1.5.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_libiio-0.1.5-py3-none-any.whl (110.9 kB view details)

Uploaded Python 3

File details

Details for the file pytest_libiio-0.1.5.tar.gz.

File metadata

  • Download URL: pytest_libiio-0.1.5.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

Hashes for pytest_libiio-0.1.5.tar.gz
Algorithm Hash digest
SHA256 afe2e4b97150c76538f9d3a11a385b3ea7cd35fcefd99306291407aca642bcf6
MD5 bac5f31c1b447285406dbbc625fdb25e
BLAKE2b-256 3662e6c6c88542459a068f0a894c0713909f1aeb85a20d3ae618428b13f403a1

See more details on using hashes here.

File details

Details for the file pytest_libiio-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pytest_libiio-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 110.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytest_libiio-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7ca64fdcdaf83e9d2b93545aae21a4795b9db60e13b1ce92d2bea2d82fb133
MD5 14ae1c6f633a7932e9017ee34c35e464
BLAKE2b-256 d3783dbd434fb80717fbadea5229b02f33d95faaf920f353cec1b78d041898ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page