Skip to main content

partest

Methodology-driven API (and optional UI) autotest harness for Python, with OpenAPI coverage that measures whether the right test cases exist — not just whether an endpoint was called.

pip install partest
pip install 'partest[ui]'     # + Playwright and Pillow for UI suites

What you get

  • ApiClient — async HTTP for suites: JSON, form, files, raw content=, multi-status expectations, GraphQL, and rich status-mismatch errors.
  • Coverage by methodology — every operation is classified into a method subtype, and each subtype has a required set of test cases. The report tells you which cases are missing.
  • A UI methodology too — surface types (list, form, card, shell, dialog, report), the check families each one owes, and the depth each check has to reach. The surface type is declared by your page object: nothing guesses it from markup.
  • A scaffold, if you want one — partest-gen is a separate package that writes a runnable suite straight from an OpenAPI file.
  • Reporting — check_* helpers, Allure steps and attaches (Allure is a soft dependency), interactive HTML coverage, coverage.json, compare / badge / stub CLI.
  • Auth, tracking, security — OIDC TokenManager with injected credentials, created-resource tracking with LIFO cleanup, SecHttp raw transport, JWT tampering sets, RiskProfile.
  • UI extra — BasePage, PageMonitor, storage helpers, visual comparison, baseline capture.

A first test

confpartest.py next to pytest.ini names the specification coverage is measured against — swagger_files = {"api": ["url", "https://api.example.com/openapi.json"]} — and pythonpath = . in pytest.ini keeps the suite root importable.

import pytest

from partest import ApiClient, BaseModelWithConfig, BaseResponseValidator, TypesTestCases
from partest.zorro_report import zorro

types = TypesTestCases


class Item(BaseModelWithConfig):
    id: int
    name: str


class ItemValidation(BaseResponseValidator):
    @property
    def ResponseSuccessBody(self):
        return Item


@pytest.fixture(scope="session")               # usually in conftest.py
def api_client():
    return ApiClient("https://api.example.com")


@pytest.mark.asyncio
async def test_get_item(api_client):
    """Item is returned by id."""
    await api_client.make_request(
        "GET",
        "/items",
        add_url1="/1",                    # on the wire: /items/1
        defining_url="/items/{id}",       # OpenAPI template — this is what coverage matches
        expected_status_code=200,
        validate_model=ItemValidation(),  # an instance, not the class
        type=types.request_default,       # explicit type beats inference
    )


def test_zorro():
    report = zorro()                      # Allure summary + coverage HTML
    # report.endpoints[*].missing_p1 → your backlog for the next test cases

Scaffold a whole suite

The generator ships separately, as partest-gen — it runs once when a project is created rather than on every test run, so it is not part of this install:

pip install partest-gen        # brings partest with it
partest-gen from-openapi ./my-suite --file openapi.yaml --depth p1 --with-ui
partest-gen sync-openapi ./my-suite --depth p1     # after the spec changes

--depth resources emits paths and collections, default adds payloads, validators and the first tests, p1 adds the full priority-one stub matrix plus a checklist per tag.

Upgrading from a version where the generator lived inside this package? The old partest.project_gen bridge is removed in 3.0.0: import from partest_gen instead. pip install 'partest[gen]' remains a convenience for installing both independent packages. The partest-gen command itself comes from the generator package, not this one.

Documentation

Source, issues and the full documentation wiki: https://github.com/Dec01/partest

The user-facing pages also ship inside the package, so they are readable next to your installed copy without a trip to the browser:

python -m partest.docs list                  # what is available
python -m partest.docs show howto-quickstart # read a page
python -m partest.docs path                  # where the files live

Included: quickstart, migration notes, the coverage methodology, permissions, upload testing, reporting, security, UI, recipes, layers, and enterprise notes (shared client, retries, redaction, xdist). The decisions behind them — why coverage is scored this way, what stays in your project — live in the repository, not the wheel.

Or from Python:

from partest.docs import list_docs, read_doc
print(read_doc("concepts-methodology.md"))

Requirements

Python 3.14+, with the suite run on 3.14. Core dependencies: httpx, pydantic, pyyaml, pytest, pytest-asyncio, allure-pytest, requests, python-dotenv, Faker, matplotlib, and Pillow>=13.0.0 (matplotlib pulls Pillow in anyway). Pillow 13 fixes the advisories open in 12.3.0; requiring Python 3.14 removes the old interpreter branch that could not install the fixed branch. PIL decodes foreign input only in partest.ui.visual.compare_images (baseline and screenshot); the coverage chart only encodes a PNG matplotlib drew. The ui extra adds playwright.

pytest 9 is required from 2.1.0 on (pytest>=9.0.3,<10). The advisory that raised the floor, PYSEC-2026-1845, has no fix in any 8.x release, so pytest 8 is not supported rather than deprecated — stay on partest 2.0.1 if you cannot move yet. The ceiling is there because partest is a pytest plugin and loads in every session: it says pytest 9 was run and pytest 10 was not, and it is lifted by a patch release once the suite passes on 10.

The bundled pytest plugin loads automatically and enriches Allure titles. Turn it off with PARTEST_PYTEST_PLUGIN=0, pytest_plugin = False in confpartest.py, or pytest -p no:partest if your project already owns Allure hooks.

License

MIT.

Metadata

Release files for partest 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for partest 3.0.0
File Size Uploaded Provenance Actions
partest-3.0.0.tar.gz 418.7 kB Without provenance Details for partest-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for partest 3.0.0
File Interpreter ABI Platform Actions
partest-3.0.0-py3-none-any.whl Python 3 none any Details for partest-3.0.0-py3-none-any.whl

Total release size: 826.5 kB

Release files / partest-3.0.0.tar.gz

Download URL partest-3.0.0.tar.gz
Size 418.7 kB
Tags Source
SHA-256 checksum
How to use checksums
985e20296dd2045f868b9f7ca73d3b7f69bc06f1afe05bd84cbc10d151bbf35b
BLAKE2b-256 checksum
How to use checksums
029241761866eb767ba375b2e611a31c16ffbf194cfa47e7a46e3928abb6cc9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / partest-3.0.0-py3-none-any.whl

Download URL partest-3.0.0-py3-none-any.whl
Size 407.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b8b82f098870b3b0220200deab8d10d64a79d9aae61b20de4e440e4c455a764
BLAKE2b-256 checksum
How to use checksums
1226a09b43fcec7298b39e289d5ebb90a3c2c07561cfda3d3425b635e402e104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for partest 3.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files No provenance

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