Registry / testing / pytest-odoo

pytest-odoo

JSON →
library2.1.3pypypiunverified

A pytest plugin for running Odoo tests. It integrates with Odoo's test framework, manages database creation, and handles module dependencies. Current version is 2.1.3, targeting Odoo 14+ with Python >=3.8.

pip install pytest-odoo
INSTALL
IMPORT
SIG · PYTEST-ODOO
P
pytest-odoo
testingpythonv2.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_odoo
import pytest_odoo
import pytest_odoo

Minimal setup: set environment variables for Odoo database and run tests with pytest using the --odoo-* options.

import os import pytest # Ensure Odoo configuration is set os.environ.setdefault('ODOO_DB_HOST', 'localhost') os.environ.setdefault('ODOO_DB_PORT', '5432') os.environ.setdefault('ODOO_DB_USER', 'odoo') os.environ.setdefault('ODOO_DB_PASSWORD', 'odoo') os.environ.setdefault('ODOO_DATABASE', 'test_db') # Run tests using pytest # pytest --odoo-database test_db -v
Debug
Known issues
breakingVersion 2.0+ drops support for Odoo <14. Upgrade your Odoo version if using an older release.
fix
Update to Odoo 14+ or pin to pytest-odoo==1.4.3 if necessary.
affects: >=2.0
gotchaThe database is created and dropped automatically per test session; ensure you use a dedicated test database to avoid data loss.
fix
Use a separate database (e.g., test_db) and never point to a production database.
affects: all
deprecatedThe --odoo-ignore-scripts option is deprecated and will be removed in a future version.
fix
Replace with --odoo-xmlrpc-port or other supported options.
affects: >=2.1.3
Upgrade
Version history
2.1.3latest on PyPI · released May 20, 2025
Audit
Dependencies
odoorequiredRuntime dependency to run Odoo tests
pytestrequiredTest framework dependency
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-odoo — pip install pytest-odoo · libregistry