Skip to main content
PyPI version Python versions See Build Status on Travis CI See Coverage Status on Coveralls Documentation 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 (new) 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

For development the following are also needed:

  • tox

  • pytest-mock

  • pre-commit

  • isort

  • flake8

  • codespell

  • black

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 contained

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"])
        ...

Future ideas

Mock testing is common with libiio’s python library since hardware is needed otherwise. In future releases we hope to extend features in pytest-mock through this plugin to make mocking libiio more streamlined.

Contributing

Contributions are very welcome. Tests can be run with tox, 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.

Release files for pytest-libiio 0.0.10

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.0.10
File Size Uploaded
pytest-libiio-0.0.10.tar.gz 56.1 kB Details

Release files / pytest-libiio-0.0.10.tar.gz

Download URL pytest-libiio-0.0.10.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee9917e1beba1f4ee7285ed9220b81ea5852fc54832c205495cb7d845300615d
BLAKE2b-256 checksum
How to use checksums
7452a4c348114063def4ee425d4c6d60c210d38d28c31215d0692e9d91b3e97e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.21

1 release file

0.0.20

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

This release

0.0.10 This release

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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