Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: How to run tests?

by
manuel
- 09/17/2014 12:21:51
Le 17/09/14 12:03, Leonardo Pistone a écrit :
> Yes, it needs to be installed to be tested. You can either do that via
> the interface, or with "-i module_name" before the test run.
>
> So to delete the database and run the tests on a fresh one (a good
> idea in any case):
>
> dropdb dbname
> createdb dbname

Done it !  Have to use a new DB instead of an old one:

The steps are:

dropdb tests
createdb tests
bin/openerp-server -i mymodule --stop-after-init -d tests
bin/openerp-server -u mymodule --log-level=test --stop-after-init -d tests


And now I see:

2014-09-17 16:15:12,340 21189 TEST xopgi openerp.modules.module: ERROR: 
test_invalid_email 
(openerp.addons.xopgi_hotfixes.tests.test_partner.TestPartnerHotfixes)
2014-09-17 16:15:12,340 21189 TEST xopgi openerp.modules.module: ` 
Invalid emails in partners are not allowed.
2014-09-17 16:15:12,341 21189 TEST xopgi openerp.modules.module: 
Traceback (most recent call last):
2014-09-17 16:15:12,341 21189 TEST xopgi openerp.modules.module: ` File 
"/home/manu/src/merchise/pgi/xopgi.hotfixes/xopgi/xopgi_hotfixes/tests/test_partner.py", 
line 24, in setUp
2014-09-17 16:15:12,341 21189 TEST xopgi openerp.modules.module: `     
self.res_partner = self.registry['res.partner']
2014-09-17 16:15:12,341 21189 TEST xopgi openerp.modules.module: ` 
TypeError: 'instancemethod' object has no attribute '__getitem__'


Now, that's a different issue, my tests are running and I'm mistaken 
about self.registry....

And the issue seems to be that I should have **called** the registry: 
self.registry('res.partner')


Thanks and bests,
Manuel.