pytest-odoo 2.1.2
pip install pytest-odoo
Released:
py.test plugin to run Odoo tests
Navigation
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Unverified details
These details have not been verified by PyPIMeta
- License: GNU Affero General Public License v3 (AGPLv3)
- Author: Guewen Baconnier
- Requires: Python >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Project description
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]
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
Alternatively, you can use environment variables, like 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.
Project details
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Unverified details
These details have not been verified by PyPIMeta
- License: GNU Affero General Public License v3 (AGPLv3)
- Author: Guewen Baconnier
- Requires: Python >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_odoo-2.1.2.tar.gz
.
File metadata
- Download URL: pytest_odoo-2.1.2.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8f542e5e3b17f8150bc32beb36b340e7fb6c59b5a9dedce35c021097ad98456 |
|
MD5 | 0dfd84469250e6597961275e85631cce |
|
BLAKE2b-256 | 5accfb1bb767db03873dfd1e74956049ac2235291deb37a5190379dc3ec64f19 |
Provenance
The following attestation bundles were made for pytest_odoo-2.1.2.tar.gz
:
Publisher:
pypi.yml
on camptocamp/pytest-odoo
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_odoo-2.1.2.tar.gz
- Subject digest:
f8f542e5e3b17f8150bc32beb36b340e7fb6c59b5a9dedce35c021097ad98456
- Sigstore transparency entry: 180925354
- Sigstore integration time:
- Permalink:
camptocamp/pytest-odoo@b599ed61599724ebba874d4eeaac65fcfb07cb53
- Branch / Tag:
refs/tags/2.1.2
- Owner: https://github.com/camptocamp
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
pypi.yml@b599ed61599724ebba874d4eeaac65fcfb07cb53
- Trigger Event:
push
- Statement type:
File details
Details for the file pytest_odoo-2.1.2-py3-none-any.whl
.
File metadata
- Download URL: pytest_odoo-2.1.2-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552926e4709835fc5314da21041d97d7ade1f4224cb767e5c3e4db8a272bd83d |
|
MD5 | c1fbef8c853cdb2b108b9647495a27d0 |
|
BLAKE2b-256 | 4a91b11505eb2c2b3d85df86ddf72de8464d721cc6de6b5d06dad1204065e1c7 |
Provenance
The following attestation bundles were made for pytest_odoo-2.1.2-py3-none-any.whl
:
Publisher:
pypi.yml
on camptocamp/pytest-odoo
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_odoo-2.1.2-py3-none-any.whl
- Subject digest:
552926e4709835fc5314da21041d97d7ade1f4224cb767e5c3e4db8a272bd83d
- Sigstore transparency entry: 180925367
- Sigstore integration time:
- Permalink:
camptocamp/pytest-odoo@b599ed61599724ebba874d4eeaac65fcfb07cb53
- Branch / Tag:
refs/tags/2.1.2
- Owner: https://github.com/camptocamp
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
pypi.yml@b599ed61599724ebba874d4eeaac65fcfb07cb53
- Trigger Event:
push
- Statement type: