skillfed

django-webtest

Instant integration of Ian Bicking's WebTest (http://docs.pylonsproject.org/projects/webtest/) with Django's testing framework.

django-webtest v1.9.14 263.3K downloads/30d#8,358 on PyPI337
Permissive license MIT license AGING released

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-webtest

uv

uv add django-webtest

poetry

poetry add django-webtest

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Tags

django functional testingwebtest django integrationdjango wsgi test clientdjango form testingdjango integration testing
django-testingwsgi-testingfunctional-testing

More Python Modules packages