Why are the purchase module's unit tests not executed?

Asked by Don Kirkby

While I was reading up on how to create unit tests, I noticed that the purchase module doesn't actually execute its unit tests.

Should they get fixed and added back, or should they get deleted so they don't look like they're working?

I'm looking at the 5.0 branch of the openobject-addons project.
There are unit tests defined in addons/purchase/purchase_unit_test.xml, but addons/purchase/__terp__.py never references that file.
When the unit tests were added in revision 828, the purchase_unit_test.xml file was included in the demo_xml entry. In revision 1256, that file got commented out, and then some time later it got completely removed from __terp__.py.

I tried adding them back in myself, but they failed with this stack trace:

[2010-03-02 15:22:07,874] ERROR:init:[02]: Environment Information :
[2010-03-02 15:22:07,874] ERROR:init:[03]: System : Linux-2.6.31-19-generic-i686-with-Ubuntu-9.10-karmic
[2010-03-02 15:22:07,874] ERROR:init:[04]: OS Name : posix
[2010-03-02 15:22:07,875] ERROR:init:[05]: Distributor ID: Ubuntu
[2010-03-02 15:22:07,875] ERROR:init:[06]: Description: Ubuntu 9.10
[2010-03-02 15:22:07,875] ERROR:init:[07]: Release: 9.10
[2010-03-02 15:22:07,875] ERROR:init:[08]: Codename: karmic
[2010-03-02 15:22:07,875] ERROR:init:[09]: Operating System Release : 2.6.31-19-generic
[2010-03-02 15:22:07,875] ERROR:init:[10]: Operating System Version : #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010
[2010-03-02 15:22:07,876] ERROR:init:[11]: Operating System Architecture : 32bit
[2010-03-02 15:22:07,876] ERROR:init:[12]: Operating System Locale : en_CA.UTF8
[2010-03-02 15:22:07,876] ERROR:init:[13]: Python Version : 2.6.4
[2010-03-02 15:22:07,876] ERROR:init:[14]: OpenERP-Server Version : 5.0.7
[2010-03-02 15:22:07,876] ERROR:init:[15]: Last revision No. & ID :
[2010-03-02 15:22:07,876] ERROR:init:[16]: <function model="account.invoice" name="pay_and_reconcile">
[2010-03-02 15:22:07,877] ERROR:init:[17]: <value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_id.id]"/>
[2010-03-02 15:22:07,877] ERROR:init:[18]: <value eval="1164"/>
[2010-03-02 15:22:07,877] ERROR:init:[19]: <value search="[('type', '=', 'cash')]" model="account.account"/>
[2010-03-02 15:22:07,877] ERROR:init:[20]: <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/>
[2010-03-02 15:22:07,877] ERROR:init:[21]: <value eval="ref('account.bank_journal')"/>
[2010-03-02 15:22:07,877] ERROR:init:[22]: <value search="[('type', '=', 'cash')]" model="account.account"/>
[2010-03-02 15:22:07,878] ERROR:init:[23]: <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/>
[2010-03-02 15:22:07,878] ERROR:init:[24]: <value eval="ref('account.bank_journal')"/>
[2010-03-02 15:22:07,878] ERROR:init:[25]: </function>
bzr: ERROR: Not a branch: "/home/don/".
No LSB modules are available.
[2010-03-02 15:22:08,367] ERROR:web-services:[01]:
[2010-03-02 15:22:08,368] ERROR:web-services:[02]: Environment Information :
[2010-03-02 15:22:08,369] ERROR:web-services:[03]: System : Linux-2.6.31-19-generic-i686-with-Ubuntu-9.10-karmic
[2010-03-02 15:22:08,369] ERROR:web-services:[04]: OS Name : posix
[2010-03-02 15:22:08,369] ERROR:web-services:[05]: Distributor ID: Ubuntu
[2010-03-02 15:22:08,369] ERROR:web-services:[06]: Description: Ubuntu 9.10
[2010-03-02 15:22:08,369] ERROR:web-services:[07]: Release: 9.10
[2010-03-02 15:22:08,369] ERROR:web-services:[08]: Codename: karmic
[2010-03-02 15:22:08,369] ERROR:web-services:[09]: Operating System Release : 2.6.31-19-generic
[2010-03-02 15:22:08,370] ERROR:web-services:[10]: Operating System Version : #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010
[2010-03-02 15:22:08,370] ERROR:web-services:[11]: Operating System Architecture : 32bit
[2010-03-02 15:22:08,370] ERROR:web-services:[12]: Operating System Locale : en_CA.UTF8
[2010-03-02 15:22:08,370] ERROR:web-services:[13]: Python Version : 2.6.4
[2010-03-02 15:22:08,370] ERROR:web-services:[14]: OpenERP-Server Version : 5.0.7
[2010-03-02 15:22:08,370] ERROR:web-services:[15]: Last revision No. & ID :
[2010-03-02 15:22:08,370] ERROR:web-services:[16]: Exception in call: Traceback (most recent call last):
[2010-03-02 15:22:08,370] ERROR:web-services:[17]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/wizard/__init__.py", line 73, in execute_cr
[2010-03-02 15:22:08,371] ERROR:web-services:[18]: action_res = action(self, cr, uid, data, context)
[2010-03-02 15:22:08,371] ERROR:web-services:[19]: File "/home/don/workspace/openerp-bzr/addons/5.0/base_setup/wizard/wizard_base_setup.py", line 205, in _update
[2010-03-02 15:22:08,371] ERROR:web-services:[20]: (db, pool)=pooler.restart_pool(cr.dbname, update_module=True)
[2010-03-02 15:22:08,371] ERROR:web-services:[21]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/pooler.py", line 62, in restart_pool
[2010-03-02 15:22:08,371] ERROR:web-services:[22]: return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
[2010-03-02 15:22:08,372] ERROR:web-services:[23]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/pooler.py", line 40, in get_db_and_pool
[2010-03-02 15:22:08,372] ERROR:web-services:[24]: addons.load_modules(db, force_demo, status, update_module)
[2010-03-02 15:22:08,372] ERROR:web-services:[25]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/addons/__init__.py", line 740, in load_modules
[2010-03-02 15:22:08,372] ERROR:web-services:[26]: r = load_module_graph(cr, graph, status, report=report)
[2010-03-02 15:22:08,372] ERROR:web-services:[27]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/addons/__init__.py", line 642, in load_module_graph
[2010-03-02 15:22:08,372] ERROR:web-services:[28]: tools.convert_xml_import(cr, m, fp, idref, mode=mode, noupdate=True, **kwargs)
[2010-03-02 15:22:08,373] ERROR:web-services:[29]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/tools/convert.py", line 873, in convert_xml_import
[2010-03-02 15:22:08,373] ERROR:web-services:[30]: obj.parse(doc.getroot())
[2010-03-02 15:22:08,373] ERROR:web-services:[31]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/tools/convert.py", line 770, in parse
[2010-03-02 15:22:08,373] ERROR:web-services:[32]: self._tags[rec.tag](self.cr, rec, n)
[2010-03-02 15:22:08,373] ERROR:web-services:[33]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/tools/convert.py", line 314, in _tag_function
[2010-03-02 15:22:08,373] ERROR:web-services:[34]: _eval_xml(self,rec, self.pool, cr, uid, self.idref, context=context)
[2010-03-02 15:22:08,373] ERROR:web-services:[35]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/tools/convert.py", line 152, in _eval_xml
[2010-03-02 15:22:08,374] ERROR:web-services:[36]: res = getattr(model, method)(cr, uid, *args)
[2010-03-02 15:22:08,374] ERROR:web-services:[37]: File "/home/don/workspace/openerp-bzr/addons/5.0/account/invoice.py", line 942, in pay_and_reconcile
[2010-03-02 15:22:08,374] ERROR:web-services:[38]: move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
[2010-03-02 15:22:08,374] ERROR:web-services:[39]: File "/home/don/workspace/openerp-bzr/addons/5.0/account/account.py", line 914, in create
[2010-03-02 15:22:08,374] ERROR:web-services:[40]: result = super(account_move, self).create(cr, uid, vals, c)
[2010-03-02 15:22:08,374] ERROR:web-services:[41]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/osv/orm.py", line 2854, in create
[2010-03-02 15:22:08,375] ERROR:web-services:[42]: result += self._columns[field].set(cr, self, id_new, field, vals[field], user, rel_context) or []
[2010-03-02 15:22:08,375] ERROR:web-services:[43]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/osv/fields.py", line 448, in set
[2010-03-02 15:22:08,375] ERROR:web-services:[44]: id_new = obj.create(cr, user, act[2], context=context)
[2010-03-02 15:22:08,375] ERROR:web-services:[45]: File "/home/don/workspace/openerp-bzr/addons/5.0/account/account_move_line.py", line 795, in create
[2010-03-02 15:22:08,375] ERROR:web-services:[46]: if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
[2010-03-02 15:22:08,375] ERROR:web-services:[47]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/osv/orm.py", line 2203, in read
[2010-03-02 15:22:08,375] ERROR:web-services:[48]: result = self._read_flat(cr, user, select, fields, context, load)
[2010-03-02 15:22:08,375] ERROR:web-services:[49]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/osv/orm.py", line 2274, in _read_flat
[2010-03-02 15:22:08,375] ERROR:web-services:[50]: order_by), sub_ids)
[2010-03-02 15:22:08,376] ERROR:web-services:[51]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/sql_db.py", line 77, in wrapper
[2010-03-02 15:22:08,376] ERROR:web-services:[52]: return f(self, *args, **kwargs)
[2010-03-02 15:22:08,376] ERROR:web-services:[53]: File "/home/don/workspace/openerp-bzr/server/5.0/bin/sql_db.py", line 122, in execute
[2010-03-02 15:22:08,376] ERROR:web-services:[54]: res = self._obj.execute(query, params)
[2010-03-02 15:22:08,376] ERROR:web-services:[55]: ProgrammingError: operator does not exist: integer = boolean
[2010-03-02 15:22:08,376] ERROR:web-services:[56]: LINE 1: ...ELECT "active",id FROM "account_account" WHERE id IN (false)...
[2010-03-02 15:22:08,376] ERROR:web-services:[57]: ^
[2010-03-02 15:22:08,376] ERROR:web-services:[58]: HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Don Kirkby
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#1

Hello Don Kirkby ,

Apply the following patch and notify me?

=== modified file 'purchase/purchase_unit_test.xml'
--- purchase/purchase_unit_test.xml 2008-09-10 17:56:00 +0000
+++ purchase/purchase_unit_test.xml 2010-03-03 10:14:35 +0000
@@ -99,10 +99,10 @@
         <function model="account.invoice" name="pay_and_reconcile">
             <value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_id.id]" />
             <value eval="1164" />
- <value search="[('type', '=', 'cash')]" model="account.account"/>
+ <value eval="ref('account.cash')"/>
             <value eval="ref('account.period_' + str(int(time.strftime('%m'))))" />
             <value eval="ref('account.bank_journal')" />
- <value search="[('type', '=', 'cash')]" model="account.account"/>
+ <value eval="ref('account.cash')"/>
             <value eval="ref('account.period_' + str(int(time.strftime('%m'))))" />
             <value eval="ref('account.bank_journal')" />
         </function>

Thanks.

Revision history for this message
Don Kirkby (donkirkby) said :
#2

Thanks vra (openerp), that solved my question.

Revision history for this message
Don Kirkby (donkirkby) said :
#3

Will you add the unit tests back into __terp__.py, or should I create a bug report with a merge proposal?

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#4

Hello Don Kirkby,

You can report a bug with merge proposal with above changes.This is good idea so it will be merged by quality team member.

Thanks.

Revision history for this message
Don Kirkby (donkirkby) said :
#5

I reported a bug and attached a merge proposal. Thanks for the help.