.. toctree:: :maxdepth: 2 Zeroincombenze® continuous testing for odoo ------------------------------------------- This package is an plug-in of **zerobug** package and aim to easily create odoo tests. It replaces OCA MQT with some nice additional features. *z0bug_odoo* is built on follow concepts: * Odoo version independent; it can test Odoo from 6.1 until 16.0 * It is designed to run in local environment too, using `local travis emulator `_ * It can run with full or reduced set of pylint tests * Test using ready-made database records * Quality Check Id travis ci support ----------------- The goal of z0bug_odoo is to provide helpers to ensure the quality of Odoo addons. The code was forked from OCA MQT but some improvements were added. This package and OCA MQT differ by: * z0bug_odoo can also test Odoo 6.1 and 7.0 where OCA MQT fails with these versions * z0bug_odoo is designed to execute some debug statements, mainly in local environment * z0bug_odoo has more options to run with reduced set of lint tests * OCA MQT is the only component to build environment and test Odoo while z0bug_odoo is part of `Zeroincombenze® tools `_ * As per prior rule, building test environment is made by `vem `_, `clodoo `_ and `lisa `_. These commands can also build a complete Odoo environment out of the box To make a complete test on TravisCI your project following 3 files are required: * .travis.yml * requirements.txt * oca_dependencies.txt File .travis.yml ~~~~~~~~~~~~~~~~ In order to setup TravisCI continuous integration for your project, just copy the content of the `sample_files `_ to your project’s root directory. Then execute the command: :: make_travis_conf /travis_emulator/template_travis.yml .travis.yml You can check travis syntax with the `lint checker `_ of travis, if available. Notice: if you do not use travisCi web site, you can avoid to set .travis.yml file. Local travis emulator and z0bug_odoo create local .travis.yml dinamically. Odoo test integration ~~~~~~~~~~~~~~~~~~~~~ Current Odoo project version is declared by **VERSION** variable. If your Odoo module must be tested against Odoo core, you can test specific github repository by **ODOO_REPO** variable. You can test against: * odoo/odoo * OCA/OCB * zeroincombenze/OCB * librerp/OCB You can test against specific Odoo core version with ODOO_BRANCH variable if differs from your project version: :: # Odoo Branch 16.0 - VERSION="16.0" ODOO_REPO="odoo/odoo" # Pull request odoo/odoo#143 - VERSION="pull/143" ODOO_REPO="OCA/OCB" # Branch saas-17 - ODOO_REPO="odoo/odoo" ODOO_BRANCH="saas-17" OCB / core test ~~~~~~~~~~~~~~~ Zeroincombenze® OCB uses submodules. When test is starting, travis-ci upgrades repository and submodules. To avoid submodules upgrade use this directive compatible with OCA MQT: :: - git: submodules: false z0bg_odoo set security environment. You do not need to add any security statements. You can avoid the following OCA MQT directive: :: - pip install urllib3[secure] --upgrade; true z0bg_odoo does some code upgrade. You can avoid following directive in ODOO_TEST_SELECT="APPLICATIONS": :: - sed -i "s/self.url_open(url)/self.url_open(url, timeout=100)/g" ${TRAVIS_BUILD_DIR}/addons/website/tests/test_crawl.py; You can avoid following directive in ODOO_TEST_SELECT="LOCALIZATION": :: - sed -i "/'_auto_install_l10n'/d" ${TRAVIS_BUILD_DIR}/addons/account/__manifest__.py Python version ~~~~~~~~~~~~~~ Odoo version from 6.1 to 10.0 are tested with python 2.7 From Odoo 11.0, python3 is used. You can test against 3.5, 3.6, 3.7 and 3.8 python versions. Currently, python 3.8 is not yet supported. This is the declaration: :: python: - "3.5" - "3.6" - "3.7" - "3.8" Notice: python 3.5 support is ended on 2020 and 3,6 is ended on 2021. Python 3.8 is no yet full supported by Odoo (2021), so use python 3.7 Deployment and setup environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to deploy test environment and setup code you have to declare some .travis.yml directives divides in following 3 parts: * Linux packages needed * PYPI packages * Odoo repositories dependencies Linux packages must be declared in `` section of .travis.yml using Ubuntu namespace. If you run test in local environment, travis emulator automatically translate Ubuntu names into your local distro names, if necessary. See `travis emulator `_ guide for furthermore info. The PYPI packages, installable by PIP are declared in standard PIP way, using **requirements.txt** file. If your project depends on other Odoo Github repositories like OCA, create a file called **oca_dependencies.txt** at the root of your project and list the dependencies there. One per line like so: project_name optional_repository_url optional_branch_name During testbed setup, z0bug_odoo will automatically download and place these repositories accordingly into the addon path. Note on addons path ordering: they will be placed after your own repo, but before the odoo core repo. If missed optional_repository_url, the repository is searched for repository with the same owner of tested project. Please note this behaviour differs from OCA MQT. OCA MQT always loads OCA repository while z0bug_odoo searches for current owner repository. So you will test both with z0bug_ood and both OCA MQT, always insert the full repository URL. Test execution ~~~~~~~~~~~~~~ Tests run by travis_run_test command. The script is deployed in _travis directory of **zerobug** package. Command have to be in `