Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: assert_equals in yaml python blocks

by
Leonardo Pistone
- 09/23/2014 08:28:02
Hi Leonardo,

it is indeed indeed a dependency for tests. That's of course the case
every time some code depends on some test library like nose, py.test
(or cucumber or rspec and so on). I wouldn't call that "fake": it is
very important to make our life easier when writing (a lot of) tests.

I got to that because when writing yaml tests I clashed with bugs and
limitations many times (you can find some still open issues of mine on
github). I find that yaml_import.py duplicates in a very brittle way
some features that are already there (for example assert_equals).

Moreover, my point is that it is true that in the Odoo core there is a
certain resistance to dependencies (see the famous "NIH syndrome" post
by Antony), but in cases like that one I really see no harm.

I'm not imposing that to others of course, It just makes my life
easier on my code.

Thanks!

On Tue, Sep 23, 2014 at 1:39 PM, Leonardo "LeartS" Donelli
<learts92@gmail.com> wrote:
> That dependency is necessary only for running the tests though, and I
> don't think putting nose in __openerp__.py as a python dependency,
> when it isn't really required for the module to work, is a good
> practice. Or at least it should be highlighted.
>
> Can't you just use YAML !assert blocks and your 3 lines python
> equivalent of assert_equals when YAML !assert doesn't work? It's
> standard python and not that much longer.
>
> What I'm saying is: Between yaml !assert, yaml !python blocks, and
> unittests, I'm no sure the missing assert_equals is enough to justify
> adding a "fake" dependency to the module, required only to run tests.