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.4.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.4-py3-none-any.whl (110.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_libiio-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 4220a5f7c95c14c3119206d2ca633ef1e0928bd982d9a541a3f95b6b1915500e
MD5 ee0d3b22a9bee293e4aa9efab02bf114
BLAKE2b-256 31c64d3826924dffa9764f0ee1c71f6983aab0446b453a0384c4a58a2e7d8955

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_libiio-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 078697952456a2b6a04b2ffdfd2c45431ca37e0789c5e2f97ea55f3f8ef4dc9b
MD5 c797d789909cd2bf6ff900f8e246b87b
BLAKE2b-256 66c2e6e294a8d46a4ec6ce2c23e6c4e4787f93c64fd9fef987ef4d3105c497b4

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