Metadata-Version: 2.4
Name: pytest-devant-cloud
Version: 0.1.0
Summary: pytest plugin that streams runs, results, and step trees to Devant Cloud's /v1/runs API.
Project-URL: Homepage, https://github.com/devant-net/devq-cloud/tree/main/packages/pytest-devant-cloud
Project-URL: Repository, https://github.com/devant-net/devq-cloud
Author: Devant Cloud
License: DevQ Cloud Enterprise License
        
        Copyright (c) 2026 DevQ Cloud. All rights reserved.
        
        ================================================================================
        THIS IS A TEMPLATE. Review with legal counsel before publishing to npm.
        ================================================================================
        
        1. DEFINITIONS
        
           "Software" means this npm package and its source code, including all
           modifications and derivative works.
        
           "Service" means the DevQ Cloud hosted product made available by DevQ Cloud
           to its customers.
        
           "Subscription" means a current, paid commercial agreement between you and
           DevQ Cloud authorising use of the Service, OR a free-tier registration
           accepted by DevQ Cloud.
        
           "You" means the individual or legal entity exercising rights under this
           License.
        
        2. GRANT OF USE
        
           Subject to the terms below and the existence of an active Subscription,
           DevQ Cloud grants You a non-exclusive, non-transferable, revocable license
           to:
        
           (a) install and run the Software on Your own systems and continuous
               integration infrastructure;
           (b) use the Software solely to connect to and interact with the Service;
           (c) make modifications to the Software for Your own internal use, provided
               such modifications are not distributed.
        
        3. RESTRICTIONS
        
           You may not, except to the extent expressly permitted by applicable law:
        
           (a) redistribute, sublicense, sell, rent, lease, or otherwise transfer the
               Software or any modified version of the Software to any third party;
           (b) use the Software to provide a managed, hosted, or commercial service
               that competes with the Service;
           (c) remove, alter, or obscure any proprietary notices in the Software;
           (d) reverse engineer, decompile, or disassemble the Software, except as
               expressly permitted by applicable law notwithstanding this limitation;
           (e) use the Software in violation of any applicable law or regulation.
        
        4. NO TRANSFER OF OWNERSHIP
        
           The Software is licensed, not sold. DevQ Cloud retains all right, title,
           and interest in and to the Software, including all intellectual property
           rights.
        
        5. TERMINATION
        
           This License terminates automatically and immediately if Your Subscription
           ends, expires, or is terminated for any reason. Upon termination, You must
           cease all use of the Software and destroy all copies in Your possession.
        
        6. NO WARRANTY
        
           THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
           IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
           FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
        
        7. LIMITATION OF LIABILITY
        
           IN NO EVENT SHALL DEVQ CLOUD OR ITS CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
           DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR
           OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE
           USE OR OTHER DEALINGS IN THE SOFTWARE. DEVQ CLOUD'S TOTAL LIABILITY FOR
           ALL CLAIMS RELATED TO THE SOFTWARE SHALL NOT EXCEED THE FEES PAID BY YOU
           FOR THE SUBSCRIPTION IN THE TWELVE (12) MONTHS PRECEDING THE CLAIM.
        
        8. GOVERNING LAW
        
           This License is governed by the laws of the jurisdiction in which DevQ
           Cloud is incorporated, without regard to its conflict of law principles.
        
        9. ENTIRE AGREEMENT
        
           This License, together with the Subscription terms, constitutes the
           entire agreement between You and DevQ Cloud concerning the Software and
           supersedes all prior or contemporaneous agreements, proposals, or
           communications.
        
        For commercial licensing inquiries, contact: licensing@devq.cloud
License-File: LICENSE
Keywords: ci,devant,devq,pytest,reporter,test-reporting
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: httpx>=0.24
Requires-Dist: pytest>=7.0
Description-Content-Type: text/markdown

# pytest-devant-cloud

pytest plugin that streams runs, results, and per-test step trees into
[Devant Cloud](https://github.com/devant-net/devq-cloud) as your suite
executes — the Python sibling of `@devant-net/playwright-reporter`.

## Install

```bash
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 |
|---|---|---|
| `DEVQ_API_URL` | `http://localhost:32124` | Your tenant's URL |
| `DEVQ_TOKEN` | `dev-admin-token` | Bearer token (CI/CD settings) |
| `DEVQ_PROJECT_ID` | `1` | Devant Cloud project id |
| `DEVQ_RUN_NAME` | `pytest — <ISO date>` | Display name on the run |
| `DEVQ_RUN_ID` | _(unset)_ | Attach to an externally-created run instead of creating one |

Or with CLI flags:

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

To disable the plugin for one run without uninstalling:

```bash
pytest -p no:devant_cloud
```

## How tests bind to test cases

Each pytest item resolves to a Devant Cloud `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-create** → `POST /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 Cloud call |
|---|---|
| `pytest_sessionstart` | `POST /v1/runs` (skipped if `DEVQ_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/complete` (skipped if `DEVQ_RUN_ID` is set) |

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

## 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.
