Skip to main content

Pytest plugin providing apibean-based API testing fixtures integrated with apibean-client, designed for testing apibean REST services and datacore backends.

Project description

pytest-apibean

pytest-apibean is a pytest plugin that provides a unified, reusable testing foundation for projects built on the apibean ecosystem.

It is designed to work hand-in-hand with apibean-client to test API-driven services such as:

  • apibean-rest – RESTful API layers
  • apibean-datacore – backend data services and gateways
  • Other apibean-based microservices and integrations

Why pytest-apibean?

Testing API-centric systems often leads to repeated boilerplate: creating HTTP clients, handling authentication, managing tokens, configuring base URLs, and wiring environment-specific settings.

pytest-apibean solves this by providing:

  • A preconfigured httpx client for async API testing
  • Authentication and token management fixtures
  • Autouse setup hooks for consistent test environments
  • Centralized configuration via pyproject.toml
  • Seamless integration with apibean-client abstractions

All without forcing application-specific logic into your test suite.

apibean-client as the testing backbone

Rather than testing APIs using raw HTTP calls alone, pytest-apibean encourages a client-oriented testing model:

  • Business logic is exercised through apibean-client
  • Transport details remain encapsulated
  • Tests become more stable, expressive, and future-proof

This approach aligns unit tests, integration tests, and contract tests around the same client interface used by real consumers.

Configuration-first design

pytest-apibean follows a pyproject-first philosophy.

All test-related options can be configured via:

[tool.pytest.apibean.options]
base_url = "http://localhost:8080/api/v1"
login_path = "/auth/login"
timeout = 10.0
auto_login = true

Configuration precedence is explicit and predictable:

  1. Test fixtures
  2. pyproject.toml
  3. Environment variables
  4. Built-in defaults

Designed for real-world testing

pytest-apibean is built for:

  • Async-first APIs
  • Token-based authentication
  • Multi-service environments
  • CI-friendly workflows
  • Long-lived OSS projects

It avoids global state, supports namespace packaging, and integrates cleanly with modern tooling such as uv, httpx, and pytest >= 7.

Typical use cases

  • Integration testing for apibean-rest
  • Contract testing between services and apibean-datacore
  • End-to-end testing via apibean-client
  • Shared testing infrastructure across multiple apibean projects

Philosophy

pytest-apibean is intentionally minimal and opinionated:

  • It provides infrastructure, not test logic
  • It favors explicit configuration over magic
  • It scales from a single service to a multi-repo ecosystem

If you are building APIs with apibean, pytest-apibean lets you test them consistently, correctly, and with confidence.

Project details


Download files

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

Source Distribution

pytest_apibean-0.1.0a3.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

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

pytest_apibean-0.1.0a3-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest_apibean-0.1.0a3.tar.gz.

File metadata

  • Download URL: pytest_apibean-0.1.0a3.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for pytest_apibean-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 85c35bdfb32b079762480ed67a25b8cbb8e38ff7921cdfd611ee08c7ba543d78
MD5 182386ac8b2577f8ec567c46884ce40b
BLAKE2b-256 a7e0cbe44dcbf9338a9c776c73b00f6446b074f3dae678a99ae98bf991dd93af

See more details on using hashes here.

File details

Details for the file pytest_apibean-0.1.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_apibean-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 32695a1207038c292c12ed956e26aa1fb259099ff39c20df3c9f287981c05090
MD5 b6588cdfb8099041bf94cf68263595b2
BLAKE2b-256 24cf16861a9ff9c1f98f7e8a4e4552d6c9a1511d1967ee09a517443f5aa24d4f

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