These images provide the following guarantees:
- Odoo runtime dependencies are installed (
wkhtmltopdf,lessc, etc). - Odoo source code is in
/opt/odoo. - Odoo is installed in editable mode in a virtualenv isolated from system python packages.
- The Odoo configuration file exists at
$ODOO_RC. - The
python,pipandodoocommands found first inPATHare from that virtualenv. coverageis installed in that virtualenv.- Prerequisites for running Odoo tests are installed in that virtualenv
(this notably includes
websocket-clientand the chrome browser for running browser tests).
Environment variables:
ODOO_VERSION(8.0, ..., 14.0, ...)ODOO_RCPGHOST=postgresPGUSER=odooPGPASSWORD=odooPGDATABASE=odooPIP_INDEX_URL=https://wheelhouse.odoo-community.org/oca-simple-and-pypiPIP_DISABLE_PIP_VERSION_CHECK=1PIP_NO_PYTHON_VERSION_WARNING=1ADDONS_DIR=.ADDONS_PATH=/opt/odoo/addonsINCLUDE=EXCLUDE=OCA_GIT_USER_NAME=oca-ci: git user name to commit.potfiles[email protected]: git user email to commitOCA_ENABLE_CHECKLOG_ODOO=: enable odoo log error checking.potfiles
Available commands:
oca_install_addons: make addons to test (found in$ADDONS_DIR, modulo$INCLUDEan$EXCLUDE) and their dependencies available in the Odoo addons path. Appendaddons_path=${ADDONS_PATH},${ADDONS_DIR}to$ODOO_RC.oca_init_test_database: create a test database named$PGDATABASEwith direct dependencies of addons to test installed in itoca_run_tests: run tests of addons on$PGDATABASE, with coverage.oca_export_and_commit_pot: export.potfiles for all addons in$ADDONS_DIRthat are installed in$PGDATABASE; git commit changes if any, using$OCA_GIT_USER_NAMEand$OCA_GIT_USER_EMAIL.oca_git_push_if_remote_did_not_change: push local commits unless the remote tracked branch has evolved.oca_export_and_push_potcombines the two previous commands.oca_checklog_odoochecks odoo logs for errors (including warnings)
Build args:
- python_version (no default)
- odoo_version (no default)
- codename (default: focal)
- odoo_org_repo (default: odoo/odoo)
Tests are written using pytest in the tests directory.
You can run them using the runtests.sh script inside the container.
In the test directory, there is a docker-compose.yml to help run the tests.
Tune it to your liking, then run:
docker compose run --build test ./runtests.sh -v
This docker-compose mounts this project, and runtests.sh adds then bin directory to
the PATH for easier dev/test iteration.
There is also a devcontainer configuration.