Issue 11731

Title
currency test don't pass when Currency Rates Source Not Ready (forex)
Priority
bug
Status
resolved
Nosy list
ced, resteve, reviewbot, roundup-bot, yangoon
Assigned to
ced
Keywords
review

Created on 2022-09-23.19:11:20 by resteve, last changed 1 month ago by roundup-bot.

Messages

New changeset ac335ea7781d by Cédric Krier in branch '6.4':
Replace forex-python and fetch rates directly from EU website
https://hg.tryton.org/modules/currency/rev/ac335ea7781d

New changeset d629bd2c94a0 by Cédric Krier in branch '6.2':
Replace forex-python and fetch rates directly from EU website
https://hg.tryton.org/modules/currency/rev/d629bd2c94a0

New changeset 9c2d7b04d072 by Cédric Krier in branch '6.0':
Replace forex-python and fetch rates directly from EU website
https://hg.tryton.org/modules/currency/rev/9c2d7b04d072
New changeset 6e91e44cfdbd by Cédric Krier in branch 'default':
Replace forex-python and fetch rates directly from EU website
https://hg.tryton.org/tryton-env/rev/6e91e44cfdbd
New changeset 2097ae931118 by Cédric Krier in branch 'default':
Replace forex-python and fetch rates directly from EU website
https://hg.tryton.org/modules/currency/rev/2097ae931118
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-10-09.12:58:01

The site is down again. I think we should remove the usage of theforexapi.com and directly access the european website. For that the simplest is to implement our own tool to fetch and remove the dependency on forex-python.
forex-python is only used to fetch the rates and to set the symbol on the imported currencies. I think for the symbol we can just put the alpha_3 code if there is no symbol yet.

As such failure prevent to publish new docker images (because test are failing and the build is run on week-end which is when the website is often down), I think we should backport this fix.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-09-28.09:50:06

The site is back on.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-09-23.19:33:06
Author: [hidden] (resteve)
Date: 2022-09-23.19:11:20

Yesterday, 22/sep night we detected that currency test don't pass:

Error:

File "/tryton/trytond/trytond/modules/currency/tests/scenario_currency_rate_update.rst", line 49, in scenario_currency_rate_update.rst
Failed example:
    rate = [r for r in eur.rates if r.date < today][0]
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest scenario_currency_rate_update.rst[24]>", line 1, in <module>
        rate = [r for r in eur.rates if r.date < today][0]
    IndexError: list index out of range

Debug:

Traceback (most recent call last):
    File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/currency/currency.py", line 443, in fetch_ecb
        return get_rates(self.currency.code, date)
    File "/home/raimon/.virtualenvs/nandev2/lib/python3.9/site-packages/forex_python/converter.py", line 62, in get_rates
        raise RatesNotAvailableError("Currency Rates Source Not Ready")
forex_python.converter.RatesNotAvailableError: Currency Rates Source Not Ready
History
Date User Action Args
2022-10-30 10:37:14roundup-botsetkeyword: - backport
messages: + msg79626
2022-10-22 01:02:40roundup-botsetmessages: + msg79242
2022-10-22 01:02:34roundup-botsetmessages: + msg79241
nosy: + roundup-bot
status: testing -> resolved
2022-10-18 10:39:04yangoonsetnosy: + yangoon
2022-10-09 13:40:16reviewbotsetmessages: + msg78691
2022-10-09 13:10:20reviewbotsetmessages: + msg78666
nosy: + reviewbot
2022-10-09 13:00:49cedsetkeyword: + review
reviews: 439631003
status: in-progress -> testing
2022-10-09 12:58:01cedsetassignedto: ced
keyword: + backport
messages: + msg78665
status: closed -> in-progress
2022-09-28 09:50:06cedsetmessages: + msg78362
status: deferred -> closed
2022-09-25 20:09:54cedsetpriority: feature -> bug
type: crash -> behavior
2022-09-23 19:33:06cedsetmessages: + msg78287
nosy: + ced
status: chatting -> deferred
2022-09-23 19:11:20restevecreate