Welcome to travis_emulator documentation!

github.com Coverage License: AGPL-3

travis_emulator 1.0.2.1

github.com Coverage License: AGPL-3

Overview

Emulate travis to test application before pushing to git

Travis emulator can emulate TravisCi parsing the .travis.yml file in local Linux machine and it is osx/darwin compatible. You can test your application before pushing code to github.com web site.

Travis emulator can creates all the build declared in .travis.yml; all the builds are executed in sequential way. The directory ~/travis_log (see -l switch) keeps the logs of all builds created. Please note that log file is a binary file with escape ANSI screen code. If you want to see the log use one of following command:

travis show

less -R ~/travis_log/<build_name>.log

A travis build executes the following steps:

  • Initialize from local .travis.conf (not in travis-ci.org)

  • Optional install packages apt addons (emulatore makes just the check)

  • Optional install packages cache

  • Set global values env global

  • Execute code before_install

  • Execute matrix initialization, included python version

  • Execute build code install

  • Execute build code before_script

  • Execute build code script

  • Execute build before_cache (only if cache is effective, not emulated)

  • Execute build code after_success (emulated) or after_failure (not emulated)

  • Optional code before_deploy (only if deployment is effective, not emulated)

  • Optional code deploy (not emulated)

  • Optional code after_deploy (only if deployment is effective, not emulated)

  • Execute code after_script (not emulated)

  • Wep from local .travis.conf (not in travis-ci.org)

Read furthermore info read travis-ci phase

Difference between local travis and web site

The travis emulator works mostly like TravisCi web site. However you ha to consider some points where you run local tests:

Local software is not published

When you test on your local PC, the software is not yet publishd. Perhaps you prefer test local packages or local modules. The travis emulator with z0bug_odoo replace the commands git clone with local ln -s creating logical link with local repository, if possible. Local module are searched in the testing module directory. See Odoo structure for furthermore info.

Your PC is not TravisCi web site

Probability you have just one python interpreter and your user is not sudo enabled. The travis emulator run build just with Odoo interpreter installed even if your .travis.yml file contains more python version to test. The travis emulator does not try to install global packages because it does not change the PC configuration. Please, install manually all the global packages using apt-get, yum, dnf or your local installer software.


Features

Function

Status

Note

Execute tests in virtual environment

check

As TravisCI

Python 2 test

check

If installed in local machine

Python 3 test

check

If installed in local machine

Bash test

check

Using zerobug package

Matrix

check

Test sequentialized

Show coverage result

check

If installed in local machine

Quality check

check

With zerobug and z0bug_odoo packages

Stored images

check

In ~/VME/ directory (see -C switch)

Debug information

check

See -B and -D switches

Keep DB after test

check

See -k switch

Lint level

check

With zerobug, see -L switch

Build selection

check

See -O switch

System packages

check no_check

See -S switch

Use specific python version

check

See -y switch


Usage

Travis emulator usage

Usage: travis [-hBC][-c file][-D number][-dEFfjk][-L number][-l dir][-Mmn][-O git-org][-pqr][-S false|true][-Vv][-X 0|1][-Y file][-y pyver][-Z] action sub sub2
Travis-ci emulator for local developer environment
Action may be: [force-]lint, [force-]test, emulate (default), (new|chk|cp|mv|merge)_vm, chkconfig or parseyaml
 -h --help            this help
 -B --debug           debug mode: do not create log
 -C --no-cache        do not use stored PYPI
 -c --conf file
                      configuration file (def .travis.conf)
 -D --debug-level number
                      travis_debug_mode: may be 0,1,2,3,8 or 9 (def yaml dependents)
 -d --osx             emulate osx-darwin
 -E --no-savenv       do not save virtual environment into ~/VME/... if does not exist
 -F --full            run final travis with full features
 -f --force           force yaml to run w/o cmd subst
 -j                   execute tests in project dir rather in test dir (or expand macro if parseyaml)
 -k --keep            keep DB and virtual environment after tests
 -L --lint-level number
                      lint_check_level: may be minimal,reduced,average,nearby,oca; def value from .travis.yml
 -l --logdir dir
                      log directory (def=/home/antoniomaria/odoo/travis_log)
 -M                   use local MQT (deprecated)
 -m --missing         show missing line in report coverage
 -n --dry-run         do nothing (dry-run)
 -O --org git-org
                      git organization, i.e. oca or zeroincombenze
 -p --pytest          prefer python test over bash test when avaiable
 -q --quiet           silent mode
 -r                   run restricted mode (deprecated)
 -S --syspkg false|true
                      use python system packages (def yaml dependents)
 -V --version         show version
 -v --verbose         verbose mode
 -X 0|1               enable translation test (def yaml dependents)
 -Y --yaml-file file
                      file yaml to process (def .travis.yml)
 -y --pyver pyver
                      test with specific python versions (comma separated)
 -Z --zero            use local zero-tools

Tree directory

While travis is running this is the tree directory:

${HOME}
┣━━ build                       # build root (by TravisCI)
┃    ┣━━ ${TRAVIS_BUILD_DIR}    # testing project repository (by TravisCI)
┃    ┗━━ ${ODOO_REPO}           # Odoo or OCA/OCB repository to check with    (1) (2)
┃
┣━━ ${ODOO_REPO}-${VERSION}     # symlnk of ${HOME}/build/{ODOO_REPO}         (1)
┃
┣━━ dependencies                # Odoo dependencies                           (3)
┃
┗━━ tools                       # clone of Zeroincombenze tools               (3) (4)
     ┃
     ┣━━ zerobug                # testing library
     ┃       ┗━━ _travis        # testing commands
     ┗━━ z0bug_odoo             # Odoo testing library
             ┗━━ _travis        # testing commands

(1) Directory with Odoo or OCA/OCB repository to check compatibility of testing project
(2) If testing project is OCB, travis_install_env ignore this directory
(3) Done by then following statements in .travis.yml:
    - travis_install_env
    Above statements replace the OCA statements:
    - travis_install_nightly
(4) Done by following statements in .travis.yml::
    - git clone https://github.com/zeroincombenze/tools.git ${HOME}/tools --depth=1
    - \${HOME}/tools/install_tools.sh -qp
    - source ${HOME}/dev/activate_tools
    Above statements replace OCA following statements:
    - git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools --depth=1
    - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}

Configuration file

Values in configuration file are:

Parameter

Descriptio

Default value

CHAT_HOME

URL to web chat to insert in documentation

ODOO_SETUPS

Names of Odoo manifest files

__manifest__.py __openerp__.py __odoo__.py __terp__.py

dbtemplate

Default value for MQT_TEMPLATE_DB

openerp_template

dbname

Default value for MQT_TEST_DB

openerp_test

dbuser

Postgresql user: default value for MQT_DBUSER

$USER

UNBUFFER

Use unbuffer

0

virtualenv_opts

Default option to create virtual environment

NPM_CONFIG_PREFIX

N/D

$HOME/.npm-global

PS_TXT_COLOR

N/D

0;97;40

PS_RUN_COLOR

N/D

1;37;44

PS_NOP_COLOR

N/D

31;100

PS_HDR1_COLOR

N/D

97;42

PS_HDR2_COLOR

N/D

30;43

PS_HDR3_COLOR

N/D

30;45

PKGS_LIST

N/D

clodoo lisa odoo_score os0 python-plus travis_emulator wok_code z0bug-odoo z0lib zar zerobug

PYTHON_MATRIX

Python version available to test (space separated)



Getting started


Installation

Current version via Git

cd $HOME
git clone https://github.com/zeroincombenze/tools.git
cd ./tools
./install_tools.sh -p
source /opt/odoo/dev/activate_tools

Troubleshooting

Message “Denied inquire with psql [-U<name>]”

User <name> cannot execute psql command. Travis emulator cannot drop test database after build completation. Please configure postgresql and enable user <name> to use psql via shell. If user is not odoo declare username with following command:

please config global

and then set dbuser parameter value.

Message “false; # Warning! TODO> apt-get install <pkg>

The package <pkg> is not installed on your system. Travis emulator run at low security level and cannot install debian or rpm packages. Please install the package <pkg> via apt-get or yum or dnf based on your distro. You can use lisa to install package <pkg> on all distribution with following command:

lisa install <pkg>

History

1.0.2.1 (2021-08-06)

[IMP] devel_tools replaced by wok_code

1.0.2.1 (2021-08-03)

[IMP] Show virtual enviroment name in summary

1.0.1.2 (2021-05-31)

[FIX] readlink error

1.0.1.1 (2021-05-24)

[IMP] Local travis full emulator

1.0.0.14 (2021-04-07)

[IMP] Change message level showing

1.0.0.13 (2021-04-06)

[IMP] travis: show stack execution

1.0.0.12 (2021-03-31)

[FIX] travis: no crash it tools not found [IMP] travis: manage nvm [REF] travis: new colors output [IMP] vem: osx/darwin compatible

1.0.0.11 (2021-03-19)

[FIX] travisrc: set_executable

1.0.0.10 (2021-03-15)

[FIX] travisrc: set_executable

1.0.0.9 (2021-03-15)

[DOC] Documentation upgrade

1.0.0.8 (2021-03-05)

[IMP] travisrc: Best fileignore list [FIX] travisrc: clean_dirs [FIX] travisrc: set_executable [IMP] travis: local odoo module to not test

1.0.0.7 (2021-03-03)

[FIX] no check if python-dev is installed



Credits

Contributors


This module is part of tools project.

Last Update / Ultimo aggiornamento: 2021-08-07

Indices and tables