Skip to main content

pytest-odoo

pytest plugin to run Odoo tests

This lib allows to run the tests built in Odoo addons which are using Python’s unittest, but with the comfort of the pytest CLI. Also allowing to run tests without updating given module.

Odoo’s –test-enable machinery and pytest-odoo do not cover exactly the same scope. The Odoo’s test runner runs the tests during the upgrades of the addons, that’s why they need the “at install” and “post install” markers.

Running tests during upgrades of addons is waaay too slow to work efficiently in a TDD mode, that’s where pytest-odoo shines. Consider that all the tests are running post-install with pytest-odoo, as you must run the upgrade of the addon before (but only when needed vs each run).

At the end of the day, its beneficial to run the Odoo tests with –test-enable because, as in very rare conditions, a test can pass with pytest-odoo but not with the “at install” tests run during the upgrade (or the oposite). Pytest-odoo can be considered a development tool, but not the tool that should replace entirely –test-enable in a CI.

See also the official Odoo documentation on writing tests.

Usage

install via:

pip install pytest-odoo

usage:

pytest -s --odoo-database=test --odoo-log-level=debug_sql [--odoo-http] [--odoo-skip-at-install]

The custom options are:

  • --odoo-database: name of the database to test.

  • --odoo-log-level: log level as expected by odoo. As time of writing: info, debug_rpc, warn, test, critical, debug_sql, error, debug, debug_rpc_answer. The default is critical to have a clean output.

  • --odoo-config: path of the odoo.cfg file to use.

  • --odoo-http: Allow to launch the Odoo http instance

  • --odoo-skip-at-install: use to skip tests that are decorated with @tagged(“at_install”) (Note: this is not the default behavior because Odoo set this tag by default if not defined).

  • --odoo-db-use-env-vars: use environment variables. Using environment variables can also be achieved by setting the environment variable PYTEST_DB_USE_ENV_VARS to true.

When using environment variables, they are the same as the Odoo Docker image: * HOST: hostname of the database server * PORT: port of the database server * USER: username to access the database * PASSWORD: password to access the database

These only work in addition to --odoo-database.

You can use the ODOO_RC environment variable using an odoo configuration file, containing at least the database option with the name of the database to test:

export ODOO_RC=/path/to/odoo/config.cfg
pytest ...

The plugin is also compatible with distributed run provided by the pytest-xdist library. When tests are distributed, a copy of the database is created for each worker at the start of the test session. This is useful to avoid concurrent access to the same database, which can lead to deadlocks. The provided database is therefore used only as template. At the end of the tests, all the created databases are dropped.

The plugin is also compatible with pytest-subtests library. When test use the subTest context manager you’ll get a nice output for each sub-tests failing.

Prerequisites

To run the integration tests (which install Odoo dependencies), you need to have the following system dependencies installed (Debian/Ubuntu):

sudo apt-get install python3-dev libxml2-dev libxslt1-dev libsasl2-dev libldap2-dev libssl-dev libpq-dev postgresql-client

Release files for pytest-odoo 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-odoo 2.3.0
File Size Uploaded
pytest_odoo-2.3.0.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-odoo 2.3.0
File Interpreter ABI Platform
pytest_odoo-2.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / pytest_odoo-2.3.0.tar.gz

Download URL pytest_odoo-2.3.0.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
603fb528583de5ffcaaf8cb7f3c70a066145e001f4249f97ab676d918e0a569e
BLAKE2b-256 checksum
How to use checksums
d7759f625a5199be8bf2aaf21962c8fa30bd25a3e1ea7963665c2fa7381c657a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / pytest_odoo-2.3.0-py3-none-any.whl

Download URL pytest_odoo-2.3.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfc2b88d08109b167ba6c221b9ea41f0dd858f00251e3a05a725390260e103f0
BLAKE2b-256 checksum
How to use checksums
d0e0ef57ef43a74b34e702272ab09bff342389852baf3e20e467bff5f172185c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 release files

2.2.0

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.7.1

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.7

3 release files

0.4.5

3 release files

0.4.4

3 release files

0.4.3

3 release files

0.4.2

3 release files

0.4.1

3 release files

0.4.0

3 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

3 release files

0.2.2

3 release files

0.2.1

3 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page