django-webtest
Instant integration of Ian Bicking's WebTest (http://docs.pylonsproject.org/projects/webtest/) with Django's testing framework.
What it is and what it does
django-webtest wraps Ian Bicking's WebTest library to provide a Django TestCase subclass that creates a test application around Django's WSGI interface. It bridges the gap between Django's native test client—which is designed primarily to inspect rendered templates and context—and functional/integration testing frameworks like WebTest, which simulate real HTTP interactions.
The package exposes WebTest's API through a `self.app` object in test cases, with added conveniences: a `user` argument for authenticated requests, automatic CSRF token handling in form submissions, access to `response.templates` and `response.context`, and support for Django's native test assertions. It also integrates with django-rest-framework's authentication system and provides pytest fixtures when pytest-django is installed.
Use it for:
- Write functional tests that follow links, submit forms, and verify HTML responses without mocking the request layer
- Test form submission workflows with automatic CSRF token handling and field population
- Verify template rendering and context data in integration tests that exercise the full request/response cycle
- Test authenticated user flows by passing a user object or username to requests
- Test django-rest-framework endpoints with automatic authentication integration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates WebTest with Django's testing framework to enable functional and integration testing via WSGI, providing access to rendered templates, context, and form handling without suppressing CSRF checks by default.
Yes, if you need functional or integration testing for Django applications. The package is stable, permissively licensed, and has low install friction. The aging maintenance status (312 days since release) is a minor concern but not a blocker given the package's Production/Stable classification and active repository. Install it when Django's native test client is insufficient for your testing needs.
Install
django-webtest on PyPI
pip
pip install django-webtestuv
uv add django-webtestpoetry
poetry add django-webtestInstalling django-webtest
Before you install
Low friction install with a single runtime dependency (webtest). Maintenance status is aging—last release was 312 days ago—but the repository remains active and the package is marked Production/Stable with support for Django 4.2, 5.0, 5.1, and 5.2.
License in practice
MIT license (permissive) imposes no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install django-webtest
from django_webtest import WebTest
class MyTestCase(WebTest):
def test_page(self):
response = self.app.get('/', user='username')
assert 'Expected text' in response
Verify before relying
- Whether the aging maintenance status (312 days since last release) affects compatibility with the latest Django patch versions
- Performance characteristics when testing large or complex Django applications
Package facts
| License | MIT license (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — webtest |
| Maintenance | aging — 312 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 263,336/month — #8,358 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_webtest-1.9.14-py3-none-any.whl
Keywords: django, webtest, pytest
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pytest-djangopytest-django integrates Django with pytest,…
permissive · top 1,000 on PyPI
zope.testbrowserzope.testbrowser provides a programmable web…
unclear · top 15,000 on PyPI
Flask-WTFFlask-WTF integrates WTForms with Flask to…
permissive · top 5,000 on PyPI
django-jinjaIntegrates Jinja2 templating into Django,…
permissive · top 15,000 on PyPI
cross-webCross provides a unified interface for writing…
permissive · top 5,000 on PyPI
djangorestframeworkBuilds web APIs on top of Django with…
permissive · top 1,000 on PyPI
djangorestframework-simplejwtProvides JSON Web Token (JWT) authentication…
permissive · top 5,000 on PyPI
pytest-seleniumpytest-selenium is a pytest plugin that…
copyleft · top 15,000 on PyPI
django-noseIntegrates the nose test runner into Django's…
permissive · top 15,000 on PyPI