Skip to content

[REF] deployv_addon_gitlab_tools: Ignore 'py.warnings'

Odoo versions is showing a WARNING when there are packages changes:

  • WARNING ? py.warnings: ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

These warnings are not easy to fix since it depends on Odoo code itself or Odoo requirements.txt

A change in the requirements.txt could require a heavy migration of the code of Odoo

and this could break the Stable Odoo Policies

I was been adding a log-handler to silent these kind of errors for each project but I think it is even better showing them but ignoring them as known in the pipeline

Even the pipeline is running unittest if it is not red then all is well for us

Pipeline showing the warning:

Using the same odoo.log artifact and the following code:

import common
lines = open('14-0-gitlabtoolsmr80-moy/odoo.log').readlines()
common.resume_log(lines)

The output without this change:

(True, {'critical': [], 'errors': [], 'warnings': ['2022-09-04 22:59:24,858 450 \x1b[1;33m\x1b[1;49mWARNING\x1b[0m ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.', '2022-09-04 22:59:24,858 450 \x1b[1;33m\x1b[1;49mWARNING\x1b[0m ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:71: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.', "2022-09-04 23:03:31,408 450 \x1b[1;33m\x1b[1;49mWARNING\x1b[0m test py.warnings: /usr/lib/python3.8/unittest/case.py:763: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead."], 'warnings_trans': [], 'warnings_deprecated': [], 'import_errors': []})

The output with this change:

(True, {'critical': [], 'errors': [], 'warnings': [], 'warnings_trans': [], 'warnings_deprecated': [], 'import_errors': []})

UPDATED

Cases found

./absa_absa_odoo_12_0_1016552/12-0/odoo.log:7254:2022-09-04 05:50:57,081 23907 WARNING openerp_test py.warnings: <string>:2: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
./absa_absa_odoo_12_0_1016552/12-0/odoo.log:7291:2022-09-04 05:52:07,663 23907 WARNING openerp_test py.warnings: /usr/lib/python3.6/unittest/case.py:680: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
./absa_absa_odoo_12_0_1016552/12-0/odoo.log:8195:2022-09-04 06:08:27,149 23907 WARNING openerp_test py.warnings: /root/odoo-12.0/odoo/models.py:4997: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
./absa_absa_odoo_12_0_1016552/12-0/odoo.log:9568:2022-09-04 06:39:19,825 23907 WARNING openerp_test py.warnings: <string>:2: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
./vauxoo_stadiumsource_odoo_14_0_884254/14-0/odoo.log:883:2022-01-21 21:26:03,864 18524 WARNING openerp_template py.warnings: /.repo_requirements/virtualenv/python3.6/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/x509.py:17: CryptographyDeprecationWarning: This version of cryptography contains a temporary pyOpenSSL fallback path. Upgrade pyOpenSSL now.
WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

Using new deployv image:

https://git.vauxoo.com/vauxoo/costarica/-/jobs/1016471

WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

WARNING test py.warnings: /home/odoo/instance/extra_addons/costarica/l10n_cr_edi/models/account_edi_format.py:29: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.

https://git.vauxoo.com/vauxoo/hr-advanced/-/jobs/1016435

2022-09-04 22:57:29,406 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

2022-09-04 22:57:29,407 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:71: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

https://git.vauxoo.com/vauxoo/ecuador/-/jobs/1016514#L147

2022-09-05 00:39:37,762 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(version) < LooseVersion('0.12.0'):

2022-09-05 00:39:37,762 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:71: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(version) >= LooseVersion('0.12.2'):

https://git.vauxoo.com/vauxoo/l10n-mx-payroll/-/jobs/1016441#L31

2022-09-04 22:59:24,858 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:66: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

2022-09-04 22:59:24,858 450 WARNING ? py.warnings: /home/odoo/instance/odoo/odoo/addons/base/models/ir_actions_report.py:71: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

2022-09-04 23:03:31,408 450 WARNING test py.warnings: /usr/lib/python3.8/unittest/case.py:763: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.

https://git.vauxoo.com/vauxoo/mexico/-/jobs/1016449#L615

2022-09-04 23:09:22,352 450 WARNING test py.warnings: /home/odoo/instance/odoo/odoo/models.py:5304: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. return self.browse([rec.id for rec in self if func(rec)])

TODO: Silent WARNING only if odoo path

Merge request reports