← Back to team overview

openerp-community team mailing list archive

Re: OCA 8.0 Suggestion: use travis-ci.org for testing addons

 

Hello Sandy,

I agree: here is such a concrete example of this where we have been testing
the Brazilian Localization on Travis after every commit against OpenERP
nightly for one year now:
https://github.com/openerpbrasil/l10n_br_core/tree/develop
https://travis-ci.org/openerpbrasil/l10n_br_core/builds
This helped us to catch many bugs!

There are many things to take from your example. I'm not sure how you
detect success or failures, this is the hack I used (tee + grep for error
because as far I know OpenERP process status wasn't reliable to detect
errors, unless that changed of course):
https://github.com/openerpbrasil/l10n_br_core/blob/develop/.travis_test_script.sh#L7


Regards.


-- 
Raphaël Valyi
Founder and consultant
http://twitter.com/rvalyi <http://twitter.com/#!/rvalyi>
+55 21 3942-2434
www.akretion.com



On Tue, May 20, 2014 at 4:31 PM, Sandy Carter <
sandy.carter@xxxxxxxxxxxxxxxxxxxx> wrote:

> Hello Community.
>
> I have a proposal for submit before we start porting our projects to
> 8.0.
>
> I suggest we add travis.yml to the root of each addon repository.
> That way, we can use the free service of travis-ci.org to do initial
> testing of each MP and each commit.
>
> This will greatly reduce the amount of redundant manual testing reviews
> have to do (e.g. Fix pep8, the MP fails tests) and gives an output of
> these MPs being run on a machine which doesn't actually cost us any
> ressource. Looking at the output, we could easily see the warnings in a
> log without having to clone and run the tests myself -- a process which
> is quite time consuming.
>
> I have included my proposal travis config file template. This is a rough
> first draft, it is very possible that it needs tweaking.
> It tests on python2.6, python2.7 (possibility to add 3.4 and pypy when
> they become supported) with odoo and with ocb.
>  - It will first test pep8 compliance.
>    - Use a max line length of 120
>    - Ignore error F401 ("imported but unused") in __init__.py files.
>  - It then runs odoo in test mode for each of the modules in the
> repository.
>    - There is also a coverage report being run which shows what portion
> of the code is covered by tests (a .coveragerc  file is also provided).
>
> This would require pypi versions of both odoo and ocb. An alternative
> would be to install these with --allow-external, but I suspect this
> would require a lot more initial setup.
>
> ------------------
> # Config file .travis.yml
>
> language: python
>
> python:
>   - "2.7"
>   - "2.6"
>
> env:
>   - ODOO="odoo"
>   - ODOO="ocb"
>
> # command to install dependencies
> install: pip install ${ODOO} coveralls flake8
>
> before_script: createdb test
>
> # command to run tests, e.g. python setup.py test
> script:
>     - git diff -W HEAD^ HEAD | flake8 --diff --max-line-length=120
> --filename=__init__.py --ignore=F401
>     - git diff -W HEAD^ HEAD | flake8 --diff --max-line-length=120
> --exclude=__init__.py
>     - python -m coverage run odoo-server -d test --test-enable
> --log-level=test --stop-after-init --init=$(python -c "import os;
> print(','.join(filter(lambda x: os.path.isdir(x) and not
> x.startswith('.'), os.listdir('.'))))")
>
>
> after_success:
>   coveralls
>
> --------
> # Config file .coveragerc
>
> [report]
> omit =
>     *__init__.py
>     odoo/*
>     /usr/*
>
> # Regexes for lines to exclude from consideration
> exclude_lines =
>     # Have to re-enable the standard pragma
>     pragma: no cover
>
>     # Don't complain about null context checking
>     if context is None:
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References