--- id: tavern version: "3.6.1" license: unclear license_treatment: permissive maintenance: active --- # tavern — Simple testing of RESTful APIs License: permissive · Maintenance: active · Downloads: 267.1K/mo ## What it is and what it does Tavern lets you write API tests in plain YAML files that pytest can discover and run alongside your other tests. Instead of writing Python code for each API call and assertion, you declare the request (URL, method, headers, body) and the expected response (status code, JSON structure) in a readable, version-controllable format. It integrates directly with pytest, so you get all of pytest's reporting, plugins, and CI/CD tooling for free. The package supports testing REST APIs, MQTT message brokers, and gRPC services in the same test file. You can use pytest fixtures and hooks to extend tests, write custom validation functions in Python when YAML isn't expressive enough, and organize tests with pytest marks. It ships as a pytest plugin (auto-discovered on install), a standalone command-line tool (tavern-ci) for shell scripts, and a Python library for programmatic use. Use it for: - Write and maintain API contract tests in version control as YAML files that non-developers can read and modify. - Run API tests in CI/CD pipelines against staging or test servers, integrated with pytest's reporting and failure notifications. - Test MQTT brokers and gRPC services alongside REST APIs in a single test suite without switching frameworks. - Validate JSON response structure and values using jmespath and jsonschema without writing custom Python assertions. - Extend tests with Python fixtures and custom validation functions for complex scenarios while keeping simple tests declarative. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Tavern is a pytest plugin and command-line tool for automated testing of RESTful APIs, MQTT-based APIs, and gRPC services using a YAML-based test syntax. Yes. Tavern is actively maintained, has no known vulnerabilities, and solves a real problem—making API tests readable and maintainable. The YAML syntax is genuinely easier to write and review than Python test code for straightforward cases, and the pytest integration means you don't sacrifice tooling or ecosystem. Low install friction and permissive licensing add no friction. Best for teams that value test readability and want to keep API tests in version control as documentation. ## Install pip install tavern uv add tavern poetry add tavern ## Installing tavern Before you install: Low install friction with a pure-Python wheel distribution. Active maintenance with a recent release (61 days ago) and ongoing commits. Depends on 10 runtime packages including pytest, requests, and validation libraries—all standard, well-maintained tools. License in practice: Permissive license (MIT) means you can use, modify, and distribute Tavern freely in commercial and private projects without restriction. Quickstart: pip install tavern[pytest] # Create test_api.tavern.yaml: # --- # test_name: Test API endpoint # stages: # - name: GET request # request: # url: https://api.example.com/data # method: GET # response: # status_code: 200 pytest test_api.tavern.yaml -v Requires Python 3.11 or later. Best used with pytest; standalone CLI tool tavern-ci available but pytest integration is the recommended path. Verify before relying: - Whether the 10 runtime dependencies are all required for basic use or if some are optional for specific features. - Performance characteristics when testing high-volume or long-running API test suites. - Extent of custom Python validation function support and how it compares to other frameworks. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 267.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags api testing yaml, pytest api automation, rest api test framework, mqtt api testing, grpc service testing, declarative api tests, api contract testing, api-testing, pytest-plugin, yaml-driven [View on SkillFed](https://skillfed.io/packages/tavern) · [View on PyPI](https://pypi.org/project/tavern/)