Skip to main content

pytest-devant-cloud

pytest plugin that streams runs, results, and per-test step trees into Devant as your suite executes — the Python sibling of @devant-net/playwright-reporter.

Install

pip install pytest-devant-cloud

The plugin auto-registers via the pytest11 entry-point group. No conftest.py changes are needed.

Configure

Set env vars before invoking pytest:

Var Default Notes
DEVANT_API_URL required Your tenant's URL
DEVANT_TOKEN required CI token from Settings → CI/CD
DEVANT_PROJECT_ID required Devant project id
DEVANT_RUN_NAME pytest — <ISO date> Display name on the run
DEVANT_RUN_ID (unset) Attach to an externally-created run instead of creating one
DEVANT_COVERAGE ./coverage.xml, then <rootdir>/coverage.xml Cobertura report to submit as the run's coverage

Or with CLI flags:

pytest \
  --devant-api-url=https://acme.devq.cloud \
  --devant-token=$DEVANT_TOKEN \
  --devant-project-id=1

To disable the plugin for one run without uninstalling:

pytest -p no:devant_cloud

How tests bind to test cases

Each pytest item resolves to a Devant test_case row in this order:

  1. @pytest.mark.devant("DEF-AB12") marker on the test — looked up via GET /v1/test-cases/by-key/DEF-AB12.
  2. Exact name match (<file>::<test> nodeid) in the project → GET /v1/test-cases?search=….
  3. Auto-createPOST /v1/test-cases. The plugin prints the new key:
    [devant] minted DEF-XYZ9 for "tests/test_auth.py::test_login"
             — add @pytest.mark.devant("DEF-XYZ9") to bind it
    

Bind the key in source once and future runs (even with renames) reuse the same case.

What gets sent

pytest hook Devant call
pytest_sessionstart POST /v1/runs (skipped if DEVANT_RUN_ID is set)
pytest_runtest_makereport (wrapper) stashes setup/call/teardown reports on the item
pytest_runtest_logreport (teardown phase) resolve test case → POST /v1/runs/:id/results with step tree
pytest_sessionfinish POST /v1/runs/:id/coverage (if a Cobertura XML exists), then POST /v1/runs/:id/complete (complete skipped if DEVANT_RUN_ID is set)

The step tree includes one node per phase (setup / call / teardown) with status, duration, and longrepr captured as error_message.

Coverage

Coverage is read from the Cobertura XML pytest-cov writes, so you need --cov-report=xml — an HTML-only report produces no XML and the upload silently no-ops:

pytest --cov=myapp --cov-report=xml --cov-report=html

The plugin picks up coverage.xml from the working directory (then rootdir) by default; point it elsewhere with --devant-coverage path/to/coverage.xml or DEVANT_COVERAGE. Line and branch percentages are sent; Cobertura carries no function metric, and coverage.py's lines are its statements, so those two fields stay null. A missing or unparseable report is warned-and-skipped, never fatal.

Suites

Tests are grouped into Devant's nestable suite hierarchy. The nodeid is split into a suite chain (directories + module stem + class chain) and a leaf name (the test function plus its parametrize id):

nodeid suite_segments test case name
tests/test_x.py::test_foo ["tests", "test_x"] test_foo
tests/api/test_x.py::TestThing::test_y[a-1] ["tests", "api", "test_x", "TestThing"] test_y[a-1]

The segments are sent on both test-case resolution (POST /v1/test-cases, which find-or-creates the suite chain) and result submission (POST /v1/runs/:id/results, which stamps suite_id when still unset). Manual re-parenting in the UI is never overwritten.

CI metadata

Auto-detected for GitHub Actions, GitLab CI, CircleCI, Jenkins, and Azure DevOps, plus a generic CI=true fallback. Populates the ci_* columns on the run so the dashboard can deep-link to commits and PRs.

Download files

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

Source Distribution

pytest_devant_cloud-0.4.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

pytest_devant_cloud-0.4.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_devant_cloud-0.4.0.tar.gz.

File metadata

  • Download URL: pytest_devant_cloud-0.4.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pytest_devant_cloud-0.4.0.tar.gz
Algorithm Hash digest
SHA256 59dd7d64938e2a5563c58fe3e41c9e15c2ff153e35af004e029ceb2e323d7e52
MD5 96db6784e5a5a4a503b5f86f017fbd45
BLAKE2b-256 6904bb34617f95265dc9c7bdcb91edc7c84cf34bcf86f43c867f6897959bb632

See more details on using hashes here.

File details

Details for the file pytest_devant_cloud-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_devant_cloud-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78bed47d22cb1f23e62a274d52f0088f85a13bc9be7b6f4109950d837f951c1e
MD5 890e6a53dd31d4d788be8c3da4de1e93
BLAKE2b-256 090bbed2a2cbd663f6d8fae4ec03e43edc79ef2647f92bea8cd05d37b39b6aed

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 Sentry Error logging StatusPage Status page