From 75a50697b1be0babc87d404ed62b101a90a7a29c Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Tue, 27 Mar 2018 09:53:33 +0100 Subject: [PATCH] [FIX] module_auto_update: Add .pyo sample file (#1205) Without this patch, if your tests are run under a `PYTHONOPTIMIZE=2` precompiled environment, they'd fail with this error because a new `.pyo` file would be created.: FAIL: test_basic (openerp.addons.module_auto_update.tests.test_addon_hash.TestAddonHash) Traceback (most recent call last): ` File "/opt/odoo/auto/addons/module_auto_update/tests/test_addon_hash.py", line 41, in test_basic ` 'static/src/some.js', ` AssertionError: Lists differ: ['README.rst', 'data/f1.xml', ... != ['README.rst', 'data/f1.xml', ... ` ` First differing element 13: ` models/stuff.pyo ` static/src/some.js ` ` First list contains 1 additional elements. ` First extra element 14: ` static/src/some.js ` ` ['README.rst', ` 'data/f1.xml', ` 'data/f2.xml', ` 'i18n/en.po', ` 'i18n/en_US.po', ` 'i18n/fr.po', ` 'i18n/fr_BE.po', ` 'i18n/test.pot', ` 'i18n_extra/en.po', ` 'i18n_extra/fr.po', ` 'i18n_extra/nl_NL.po', ` 'models/stuff.py', ` 'models/stuff.pyc', ` - 'models/stuff.pyo', ` 'static/src/some.js'] Ran 3 tests in 0.005s FAILED With this patch, the `.pyo` file is included, so tests will pass anywhere. --- .../tests/sample_module/models/stuff.pyo | Bin 0 -> 109 bytes module_auto_update/tests/test_addon_hash.py | 1 + 2 files changed, 1 insertion(+) create mode 100644 module_auto_update/tests/sample_module/models/stuff.pyo diff --git a/module_auto_update/tests/sample_module/models/stuff.pyo b/module_auto_update/tests/sample_module/models/stuff.pyo new file mode 100644 index 0000000000000000000000000000000000000000..b592f19841e2fdfc90a584eb75703c9eed4782f2 GIT binary patch literal 109 zcmZSn%*$2zb3;@z0~9a;X$K%K<^U2YObm=Ej10jV%s@^iBaraR1S!w}Vsrwmp}3?p ZElsbWvIL~tCO1E&G$+*#q^}sH0{}a24`BcR literal 0 HcmV?d00001 diff --git a/module_auto_update/tests/test_addon_hash.py b/module_auto_update/tests/test_addon_hash.py index 7523b8ec4..3827c5aed 100644 --- a/module_auto_update/tests/test_addon_hash.py +++ b/module_auto_update/tests/test_addon_hash.py @@ -38,6 +38,7 @@ class TestAddonHash(unittest.TestCase): 'i18n_extra/nl_NL.po', 'models/stuff.py', 'models/stuff.pyc', + 'models/stuff.pyo', 'static/src/some.js', ])