summaryrefslogtreecommitdiff
path: root/odoo/modules/loading.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2020-01-29 12:11:24 +0000
committerXavier Morel <xmo@odoo.com>2020-02-04 12:42:35 +0000
commitb1e58ab6c621a4df4b9413eaf4dcb58e9e8d46ed (patch)
treebc979a40570bb65e5c08f9f691c039f995ed2579 /odoo/modules/loading.py
parent672709c125dae6dfb1e8931b656c04993315cf4e (diff)
[FIX] product: deprecation warning triggered by assertion
Replace an assertRaises(StopIteration) by a next() with a default value. Following PEP 479, *any* StopIteration reaching the toplevel of a generator triggers a DeprecationWarning. And while the assertRaises looks innocuous, both _assertRaises and the underlying clear_upon_failure are implemented with functools.contextmanager, which wraps a generator. As a result, exceptions raised in the assertRaises "body" get reinjected inside the wrapped context manager[0] and if the exception is a StopIteration it triggers the warning. By not using assertRaises we side-step the issue. [0] https://github.com/python/cpython/blob/b6999e5690c7006b0ba4049cfd638513c982a90c/Lib/contextlib.py#L131
Diffstat (limited to 'odoo/modules/loading.py')
0 files changed, 0 insertions, 0 deletions