Skip to main content

py.test plugin to run Odoo tests

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

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.

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-odoo-0.7.1.linux-x86_64.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

pytest_odoo-0.7.1-py2.py3-none-any.whl (17.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-odoo-0.7.1.linux-x86_64.tar.gz.

File metadata

  • Download URL: pytest-odoo-0.7.1.linux-x86_64.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pytest-odoo-0.7.1.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 01f1e22469248be50ae563fb850a96e35e80d6a678b2690b7262bd8bd3970baf
MD5 57d651d8466d965aa4682e21bf8ac37f
BLAKE2b-256 af7cce8e3dba618c38799dca37068d48f5b79274ae260d4cb67dac84c79d125c

See more details on using hashes here.

File details

Details for the file pytest_odoo-0.7.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_odoo-0.7.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pytest_odoo-0.7.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7255d697af46c43ed6edf41519f9f1a450d780e9b663e68b5ff571a8aaf351b7
MD5 67fcd066cdbe28ad50b79f59e9eb29c8
BLAKE2b-256 f84d0388ca2dd83adabb3c0f91023fb6f8cf141f13b431a3fb5c4d46a7cfc59c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page