~therp-nl/anybox.recipe.openerp/jbaudoux-relative_paths_resolve_conflict

« back to all changes in this revision

Viewing changes to doc/contributing.rst

[MRG] Update with target branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
For contributors
 
2
================
 
3
 
 
4
Source and tracking
 
5
~~~~~~~~~~~~~~~~~~~
 
6
The recipe is currently hosted as a launchpad project, under Bazaar
 
7
version control: https://launchpad.net/anybox.recipe.openerp
 
8
 
 
9
We follow the standard launchpad workflow (bugs, merge requests…).
 
10
Code contributors are systematically added to the list of
 
11
contributors at the end of the README, unless they explicitely wish
 
12
not to (what Launchpad does is obvisouly out of our scope).
 
13
 
 
14
There are currently no branch naming rules.
 
15
 
 
16
Members of the "Anybox" team have push privileges on the main branches.
 
17
 
 
18
Using a development version
 
19
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
20
 
 
21
To use a local version of the recipe, you may use the ``develop``
 
22
general buildout option::
 
23
 
 
24
  [buildout]
 
25
  develop = /path/to/anybox.recipe.openerp
 
26
 
 
27
To track the latest version of a ``bzr`` branch of the recipe, we find
 
28
the
 
29
`gp.vcsdevelop <https://pypi.python.org/pypi/gp.vcsdevelop>`_
 
30
extension simple and useful. Here's an example (excerpt from
 
31
``buildot/recipe-trunk.cfg``)::
 
32
 
 
33
  [buildout]
 
34
  extensions = gp.vcsdevelop
 
35
  vcs-extend-develop = bzr+http://bazaar.launchpad.net/~anybox/anybox.recipe.openerp/trunk#egg=anybox.recipe.openerp
 
36
  vcs-update = True
 
37
 
 
38
.. note::
 
39
  Actually some parts of the recipe are aware of the possible use
 
40
  of ``gp.vcsdevelop`` for python dependencies, and special care of it is
 
41
  taken in the freeze and extract features. This is known to work even
 
42
  for ``zc.buildout`` itself.
 
43
 
 
44
Development setup
 
45
~~~~~~~~~~~~~~~~~
 
46
 
 
47
We recommend "developping" the source code in a virtualenv, together
 
48
with ``bzr``. For instance::
 
49
 
 
50
  virtualenv recipe-env
 
51
  recipe-env/bin/pip install bzr
 
52
  recipe-env/bin/bzr branch lp:anybox.recipe.openerp
 
53
  cd anybox.recipe.openerp
 
54
  python setup.py develop
 
55
 
 
56
Coding style
 
57
~~~~~~~~~~~~
 
58
 
 
59
The recipe follows the same strong code development coding principles
 
60
as many other projects:
 
61
 
 
62
* Style enforcement : we follow the PEP8 guidelines
 
63
* Static analysis with `flake8 <https://pypi.python.org/pypi/flake8>`_
 
64
  (combines conveniently `pep8 <https://pypi.python.org/pypi/pep8>`_
 
65
  and `pyflakes <https://pypi.python.org/pypi/pyflakes>`_).
 
66
* Unit tests : we try and test as much as possible. It is hard to achieve a
 
67
  real 100% with a tool that calls so many external processes, but
 
68
  this is mitigated by our
 
69
  :ref:`continuous integration <continuous_integration>` practice of
 
70
  doing real OpenERP installations with the latest revision of the recipe.
 
71
 
 
72
Launching static analysis and unit tests
 
73
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
74
 
 
75
Install ``nose``, ``flake8`` and, optionally, ``coverage``::
 
76
 
 
77
   recipe-env/bin/pip install nose coverage flake8==2.0 \
 
78
                      pep8=1.4.6 mccabe==0.2.1 pyflakes==0.7.3 nose
 
79
 
 
80
 
 
81
.. note:: we've had problems lately with discrepancies in ``pep8``
 
82
          versions, that's why versions of ``flake8`` and its
 
83
          dependencies are fixed above. In case of doubt, check what
 
84
          the buildbot is actually running.
 
85
 
 
86
Run ``flake8`` and the tests::
 
87
 
 
88
    cd anybox.recipe.openerp
 
89
    flake8 anybox && nosetests anybox --with-doctest
 
90
 
 
91
There is also this convenience to run the tests and output a coverage report::
 
92
 
 
93
    source ./test-cover
 
94
 
 
95
 
 
96
.. _integration tests:
 
97
 
 
98
Integration tests
 
99
~~~~~~~~~~~~~~~~~
 
100
 
 
101
There is a special category of tests: those that need a real OpenERP
 
102
instance, built with the recipe, to run.
 
103
 
 
104
They are located within the ``tests_with_openerp`` subdirectory and
 
105
need to be launched with a launcher script constructed by the recipe.
 
106
 
 
107
For example, create a testing buildout like this::
 
108
 
 
109
  [openerp]
 
110
  # version as you wish
 
111
  eggs = nose
 
112
  openerp_scripts nosetests command-line-options = -d
 
113
 
 
114
Then run ``bin/buildout``, create a database and initialize it. From
 
115
the buildout directory::
 
116
 
 
117
  createdb test-recipe
 
118
  bin/start_openerp -d test-recipe -i base --stop-after-init
 
119
 
 
120
You can then run the tests::
 
121
 
 
122
  bin/nosetests_openerp -d test-recipe -- /path/to/recipe/branch/tests_with_openerp
 
123
 
 
124
Currently, these tests are all about the ``Session`` objects, used in
 
125
scripts.
 
126
 
 
127
.. note:: you may use a different version of the recipe to build that
 
128
          testing buildout. This is anyway what happens if you build
 
129
          with your development version, and hack some changes
 
130
          afterwards.
 
131
 
 
132
          Using a very different version of the recipe could give
 
133
          funky results, but you're supposed to know what you're doing
 
134
          at this point.
 
135
 
 
136
 
 
137
.. _continuous_integration:
 
138
 
 
139
Continuous integration
 
140
~~~~~~~~~~~~~~~~~~~~~~
 
141
 
 
142
Basic builds
 
143
------------
 
144
 
 
145
Upon each push on the main branches, Anybox' public
 
146
buildbot awakes to check the coding style, run the tests and build
 
147
this documentation. You may check the status there:
 
148
 
 
149
* `trunk builder
 
150
  <http://buildbot.anybox.fr/waterfall?show=anybox.recipe.openerp>`_
 
151
* `stable builder
 
152
  <http://buildbot.anybox.fr/waterfall?show=anybox.recipe.openerp-stable>`_
 
153
 
 
154
Actual runs
 
155
-----------
 
156
 
 
157
Furthermore, this buildbot instance runs `anybox.buildbot.openerp
 
158
<https://pypi.python.org/pypi/anybox.buildbot.openerp>`_,
 
159
a buildbot configurator for OpenERP installations based on the recipe.
 
160
 
 
161
This is used in turn to run high-level integration tests, having the
 
162
latest bzr version of the recipe actually install several combinations
 
163
of OpenObject server and addons, and run their unit tests.
 
164
 
 
165
The configuration is stored in the ``buildbot`` subdirectory of the
 
166
recipe trunk branch. It is made of a high level configuration file
 
167
(``MANIFEST.cfg``) and buildout configuration files. This buildbot
 
168
instance actually aggregates several such configurations.
 
169
 
 
170
The corresponding builders are those whose name starts with
 
171
``recipe-`` or ``stable-recipe-`` in the `builders list
 
172
<http://buildbot.anybox.fr/builders>`_.
 
173
 
 
174
.. note:: the `integration tests`_ mentioned above are executed in
 
175
          particular during this process, currently in the
 
176
          ``recipe-7.0-postgresql-9.2`` builder.
 
177
 
 
178
Some builds may appear to be broken because of tests failures been
 
179
pushed by upstream in OpenERP itself or in the tested addons, but it's
 
180
easy to check whether this is due to a recipe failure or not.
 
181
 
 
182
.. note::
 
183
 
 
184
   Anybox hardware resources are limited; contributing buildslaves would
 
185
   be greatly appreciated.
 
186
 
 
187