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

This plugin is used to make the access of libiio contexts easier and to provide a unified API through fixtures.

Accessing contexts

Get list of context descriptions of all found contexts:

import pytest
import iio


def test_libiio_device(context_desc):
    hardware = ["pluto", "adrv9361", "fmcomms2"]
    for ctx_desc in context_desc:
        if ctx_desc["hw"] in hardware:
            ctx = iio.Context(ctx_desc["uri"])
    if not ctx:
        pytest.skip("No required hardware found")

Require certain hardware through marks:

import pytest
import iio


@pytest.mark.iio_hardware("adrv9361")
def test_libiio_device(context_desc):
    for ctx_desc in context_desc:
        ctx = iio.Context(ctx_desc["uri"])
        ...

Contributing

Contributions are very welcome. Tests can be run with nox, please ensure the coverage at least stays the same before you submit 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.2.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.2-py3-none-any.whl (109.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_libiio-0.1.2.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_libiio-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1613d58854399e15a2b4647104c1eeb7c98160b66c852710f8b3acb58c5c209e
MD5 ef85fb3cdc26e7b1a3815ee632344692
BLAKE2b-256 c599c99f81ac8b3c48d1e9adef7e9aded5ebe8115a5cf696d1124e4fa6637069

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pytest_libiio-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c7bfe53cb4b8cd32fdb15dbbda1464b4c86eff0ed91e77dd31918061edfb259
MD5 0547cd05489b13c6f259de36b2df3d2f
BLAKE2b-256 3b9f135cb2c5e37d683480b5fef82ea3e152e3db1d3f36a738b7105a469a1fd5

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