[Solved] Error in the execution of unit tests



Tryton version : 5.0
Python version : 3.5.3

Yesterday I wrote the first unit test for my module, and during their execution I had the following error:

File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/currency/currency.py", line 213, in currency_rate_sql
TypeError: 'Column' object is not callable

Ok I made a mistake in my test, but to check I started the test on the Sale module:

python trytond/trytond/tests/run-tests.py -v -m sale

And there same error on all scenario:

FAIL: /home/ccr/Technique/tryton/ate50/trytond/trytond/modules/sale/tests/scenario_sale.rst
Doctest: scenario_sale.rst
Traceback (most recent call last):
  File "/usr/lib/python3.5/doctest.py", line 2190, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for scenario_sale.rst
  File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/sale/tests/scenario_sale.rst", line 0

File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/sale/tests/scenario_sale.rst", line 23, in scenario_sale.rst
Failed example:
    config = activate_modules('sale')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest scenario_sale.rst[10]>", line 1, in <module>
        config = activate_modules('sale')
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/tests/tools.py", line 25, in activate_modules
      File "/home/ccr/Technique/tryton/ate50/proteus/proteus/__init__.py", line 1170, in execute
      File "/home/ccr/Technique/tryton/ate50/proteus/proteus/config.py", line 181, in __call__
        result = rpc.result(meth(*args, **kwargs))
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/wizard/wizard.py", line 287, in execute
        return wizard._execute(state_name)
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/wizard/wizard.py", line 318, in _execute
        result = self._execute(transition())
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/ir/module.py", line 582, in transition_upgrade
        pool.init(update=update, lang=lang)
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/pool.py", line 160, in init
        lang=lang, activatedeps=activatedeps)
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/__init__.py", line 423, in load_modules
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/__init__.py", line 388, in _load_modules
        load_module_graph(graph, pool, update, lang)
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/__init__.py", line 216, in load_module_graph
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/model/modelsql.py", line 200, in __register__
        sql_table = cls.__table__()
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/model/modelsql.py", line 183, in __table__
        return cls.table_query()
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/sale/sale_reporting.py", line 54, in table_query
        from_item, tables = cls._joins()
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/sale/sale_reporting.py", line 71, in _joins
        currency_sale = Currency.currency_rate_sql()
      File "/home/ccr/Technique/tryton/ate50/trytond/trytond/modules/currency/currency.py", line 213, in currency_rate_sql
    TypeError: 'Column' object is not callable

What have I forgotten?


(Sergio Morillo) #2

Please check python-sql package version.

(Sergi Almacellas Abellana) #3

Sale module requires at least 0.4 (from setup.py), test work as expected when using version 0.9 version of python-sql and should work with 1.0.0 too.


I was using the version 0.8.3 from python3-sql debian stretch package.
Following your suggestion i remove this package and i installed python-sql from pypi (v 1.0.0) and the test run correctly.
Maybe you have to update the setup.py for a 0.9 minimum version?

(Sergi Almacellas Abellana) #5

Indeed it’s not the sale which requires 0.4 but the currency module which is used to compute the currency rate using Window Functions

(Cédric Krier) #6

It should be solved by Issue 7832: currency module requires python-sql >= 0.9 - Tryton issue tracker

(system) #7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.