edgelens-pytest
pytest plugin for the EdgeLens Edge AI Device Farm — write a test that gets a real edge AI camera as a fixture, with auto-allocate, auto- release, configurable scope, OS filtering, and JUnit metadata.
Counterpart to @edgelens/playwright-plugin for
the Python world.
Install
pip install edgelens-pytest
Requires Python 3.9+. Auto-loaded by pytest via the pytest11 entry
point — no conftest.py glue needed.
Quickstart
# tests/test_camera.py
def test_inference_latency(device):
device.deploy(model="./face.cvimodel")
device.inference.start()
stats = device.inference.run(duration=30)
assert stats.fps.avg > 15
assert stats.latency_ms.p95 < 100
Run it:
export EDGELENS_API_KEY=el_test_xxx
pytest
device is session-scoped by default — one camera for the whole
run. Use --edgelens-scope=module or --edgelens-scope=function if
tests mutate device state in ways the next test would inherit broken.
Fixtures
| Fixture | Scope | What |
|---|---|---|
device |
session/module/function (CLI) | edgelens.Device ready to use |
edgelens_session |
same as device |
edgelens.Session, already past wait_ready() |
edgelens_client |
session | edgelens.EdgeLensClient |
edgelens_options |
session | EdgelensOptions derived from CLI + env |
CLI options
| Flag | Default | Purpose |
|---|---|---|
--edgelens-key |
— | API key. Prefer $EDGELENS_API_KEY: a value on the command line is visible in the process list and shell history. |
--edgelens-base-url |
— | Self-hosted EdgeLens deployments. |
--edgelens-os |
stock-os |
OS to flash. Alt: recamagined. |
--edgelens-device-type |
recamera-2002 |
Device type to allocate. |
--edgelens-scope |
session |
session / module / function. |
--edgelens-session-timeout |
3600 |
Session duration cap (s). |
--edgelens-skip-allocation |
off | Fixtures yield None. For plugin-self-testing. |
wait_ready does not need a client-side timeout: the platform
signals a readiness deadline on the session response and the
SDK trusts it. --edgelens-wait-timeout is a deprecated
escape hatch; setting it emits a PytestDeprecationWarning.
OS marker
Pin a test to a specific OS via @pytest.mark.edgelens(os=...):
import pytest
@pytest.mark.edgelens(os="recamagined")
def test_recamagined_only(device):
...
@pytest.mark.edgelens(os="stock-os")
def test_stock_only(device):
...
def test_works_on_either(device):
...
Run once per OS:
pytest --edgelens-os=stock-os
pytest --edgelens-os=recamagined
Marker mismatches surface as pytest.mark.skip with a clear reason, so
the report tells you why a test was excluded.
The same pattern works for device_type:
@pytest.mark.edgelens(device_type="some-other-device")
def test_only_for_other(device):
...
Multi-OS coverage
The fixture is session-scoped by default — one camera for the run. Mixing OS variants under a single scope would require multiple sessions, which we deliberately don't support implicitly (allocations cost money
- wall-clock time).
To cover multiple OS variants in CI, run pytest once per OS:
# .github/workflows/edgelens-matrix.yml
strategy:
matrix:
os: [stock, recamagined]
steps:
- uses: actions/checkout@v4
- uses: edgelens-ai/edgelens-sdk/ci/github-action@v0.2.2
with:
api-key: ${{ secrets.EDGELENS_API_KEY }}
command: pytest --edgelens-os=${{ matrix.os }} --junit-xml=junit.xml
For fine-grained per-test OS switching inside a single run, drop the
fixture scope to function and add a custom os_variant parametrize
in your own conftest.py (see the SDK example projects).
JUnit metadata
Each test's testcase in the JUnit XML gets these extra <property>
entries:
edgelens_session_idedgelens_macedgelens_hostedgelens_os
So the GitLab MR widget / GitHub Action summary / CI dashboard can show which camera ran which test without parsing logs.
Develop
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
See also
Pairs with @edgelens/playwright-plugin for JS/TS teams.
Metadata
Release files for edgelens-pytest 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edgelens_pytest-0.2.2.tar.gz | 9.1 kB | With provenance | Details for edgelens_pytest-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edgelens_pytest-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for edgelens_pytest-0.2.2-py3-none-any.whl |
Total release size: 19.8 kB
Release files / edgelens_pytest-0.2.2.tar.gz
| Download URL | edgelens_pytest-0.2.2.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f98435ee8ba6b568f99180c1b017c1e2445bcadd52a46232064d9ddba7a94c7
|
|
BLAKE2b-256 checksum How to use checksums |
afba2928b0821afcc4a35ee19be6e7a844807894893249c6fbb0adca0b0278b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / edgelens_pytest-0.2.2-py3-none-any.whl
| Download URL | edgelens_pytest-0.2.2-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb4882795eb3d20c31343c7021d6475d1843d1c9d54b78b2cf8842347da3582b
|
|
BLAKE2b-256 checksum How to use checksums |
20a6795eeaa4aa230099ab37d07ba4fa7a6d035c01b3befbaae2211961d88e32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for edgelens-pytest 0.2.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for edgelens_pytest-0.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA 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.