ddt
Data-Driven/Decorated Tests
What it is and what it does
ddt is a decorator-based test parameterization library for Python's unittest framework. It lets you write a single test method and run it repeatedly with different input data, with each dataset appearing as a separate test case in your test output. This eliminates the need to write multiple nearly-identical test methods or manually loop through test data within a single test.
The package has no runtime dependencies and installs as a pure Python wheel. It's been in Beta status since its first release in 2012 and receives infrequent updates, but the core functionality is stable and widely used. It integrates directly with unittest's test discovery and reporting, making parameterized tests visible in standard test runners.
Use it for:
- Run the same test logic against multiple input datasets without duplicating test code
- Generate separate test results for each data variant to identify which inputs fail
- Test boundary conditions and edge cases by supplying a list of known problem values
- Reduce test file size when you have many similar test cases with only data differences
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ddt multiplies a single test case across multiple datasets, letting you run parameterized tests that appear as separate test cases in your test runner.
Yes. ddt is a lightweight, dependency-free tool that solves a real unittest problem with a simple decorator pattern. It's stable, permissively licensed, and widely downloaded. The dormant maintenance status is not a concern for a mature utility with no external dependencies—there's little that needs updating. Install it if you use unittest and want to avoid writing repetitive parameterized test methods.
Install
ddt on PyPI
pip
pip install ddtuv
uv add ddtpoetry
poetry add ddtInstalling ddt
Before you install
Installation is straightforward with no runtime dependencies. The project is dormant (last release 900 days ago) but the repository remains active and the package is stable at Beta status.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and open-source projects without restriction.
Quickstart
pip install ddt
import unittest
from ddt import ddt, data
@ddt
class TestExample(unittest.TestCase):
@data(1, 2, 3)
def test_value(self, value):
self.assertGreater(value, 0)
Verify before relying
- Whether ddt works with modern test frameworks beyond unittest (pytest, nose, etc.)
- Performance characteristics when running hundreds or thousands of parameterized test cases
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 900 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,611,131/month — #3,719 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ddt-1.7.2-py2.py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
parameterizedParameterized testing decorator that works with…
permissive · top 5,000 on PyPI
parametrizeProvides a `@parametrize` decorator that works…
permissive · top 15,000 on PyPI
robotframework-datadriverDataDriver extends Robot Framework to generate…
permissive · top 15,000 on PyPI
testscenariostestscenarios extends Python's unittest to run…
permissive · top 15,000 on PyPI
unittest-parametrizeAdds parametrization support to unittest…
permissive · top 15,000 on PyPI
pytest-subtestsAdds subTest() support to pytest, allowing…
permissive · top 5,000 on PyPI
pytest-djangopytest-django integrates Django with pytest,…
permissive · top 1,000 on PyPI
rdrobustImplements regression discontinuity (RD) design…
copyleft · top 15,000 on PyPI
python-subunitSubunit is a streaming protocol library for…
permissive · top 5,000 on PyPI
pytest-variablesA pytest plugin that loads test variables from…
copyleft · top 15,000 on PyPI