Hello,
I develop on tryton[1] and I'd like to use py.test to test the new
modules I am writing for it.
This framework has a concept of modularity that allows some module to
override the definition of objects. An example will probably help
understanding the situation.
So we have the base trytond module which contains a `modules`
directory with the list of available modules (they are all imported
but not necessarily installed).
project/
bin/
trytond/
modules/
...
sale/
sale_cost/
...
So when you install the sale_cost module the object defined on the
sale module are extended with more fields and the methods might be
extended to fit the business case.
Currently I use a conftest.py file in the top directory in order to
define funcargs for my tests. But it looks like a suboptimal solution.
I think I can use plugins in order to do the following:
1. Define a funcarg `sale` in the sale module
2. Define a funcarg `sale` in the sale_cost module. This funcarg
should ideally use the funcarg from `sale` and extend it with
various information (if allowed to do so by the business rule).
3. Calling py.test trytond/modules/sale_cost from the project/
directory should work
This setup would allow me to provide funcargs for use to other
developers on which they can base their own tests.
Right now I noticed that the funcargs are loaded recursively. Do you
think it is possible to write a plugin that would read the dependency
information in the sale_cost module and use it to setup the conftests
file found in those modules to be imported *before* the conftest.py
from sale_cost ?
If it is, do you have any pointers on how I can do this ?
BTW, py.test is a really nice piece of software and I really enjoy
using it.
[1]: http://www.tryton.org/
--
(°> Nicolas Évrard
( ) Liège
`¯
_______________________________________________
py-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/py-dev