2023-04-26 02:38:09 |
Kenta Fukaya |
description |
Zuul raised the error "cannot import name 'Mapping' from 'collections'",
when I run FT(function test) that tacker-compliance-devstack-multinode-sol[1].
This FT causes this error including code that can only run on python3.9 or lower.
The Robotframework used in this FT calls "from collections import Mapping",[2]
but this code can only be used with Python 3.9 or lower.
If you use Python 3.10+,
this program should call 'from collections.abc import Mapping'.
However, the latest version of the robotframework fixes this error,
but this FT uses version 3.1[3][4].
We can choose two methods to fix this error.
1. Downgrade Python 3.9 or lower running in zuul.
2. Upgrade the Robotframework.
[1] https://zuul.opendev.org/t/openstack/build/821d9e0ca36b46ad8113c8a1d02b9ce3
[2] https://github.com/robotframework/robotframework/blob/v3.1/src/robot/utils/robottypes3.py#L16
[3] https://github.com/openstack/tacker/blob/master/tox.ini#L127
[4] https://forge.etsi.org/rep/nfv/api-tests/-/blob/2.6.1-fix-plu/requirements.txt#L8 |
Zuul raised the error "cannot import name 'Mapping' from 'collections'",
when I run FT(function test) that tacker-compliance-devstack-multinode-sol[1].
This FT causes this error including code that can only run on python3.9 or lower.
The Robotframework used in this FT calls "from collections import Mapping",[2]
but this code can only be used with Python 3.9 or lower.
If you use Python 3.10+,
this program should call 'from collections.abc import Mapping'.
However, the latest version of the robotframework fixes this error,
but this FT uses version 3.1[3][4].
We can choose two methods to fix this error.
1. Downgrade Python 3.9 or lower running in zuul.
2. Upgrade the Robotframework.
[1] https://zuul.opendev.org/t/openstack/build/821d9e0ca36b46ad8113c8a1d02b9ce3
[2] https://github.com/robotframework/robotframework/blob/v3.1/src/robot/utils/robottypes3.py#L16
[3] https://github.com/openstack/tacker/blob/master/tox.ini#L127
[4] https://forge.etsi.org/rep/nfv/api-tests/-/blob/2.6.1-fix-plu/requirements.txt#L8
error log
```
from .misc import plural_or_not
File "/home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api/lib/python3.10/site-packages/robot/utils/misc.py", line 21, in <module>
from .robottypes import is_integer
File "/home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api/lib/python3.10/site-packages/robot/utils/robottypes.py", line 25, in <module>
from .robottypes3 import (is_bytes, is_dict_like, is_integer, is_list_like,
File "/home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api/lib/python3.10/site-packages/robot/utils/robottypes3.py", line 16, in <module>
from collections import Mapping, UserString
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
======
Totals
======
Ran: 3 tests in 0.0022 sec.
- Passed: 0
- Skipped: 0
- Expected Fail: 0
- Unexpected Success: 0
- Failed: 3
Sum of execute time for each test: 0.0004 sec.
==============
Worker Balance
==============
- Worker 0 (3 tests) => 0:00:00.002190
Test id Runtime (s)
----------------------------------------------------------------------- -----------
unittest.loader._FailedTest.tacker.tests.compliance.sol002.test_vnflcm 0.000
unittest.loader._FailedTest.tacker.tests.compliance.sol003.test_vnflcm 0.000
unittest.loader._FailedTest.tacker.tests.compliance.sol005.test_vnfpkgm 0.000
dsvm-compliance-sol-api: 44008 C exit 1 (0.75 seconds) /home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api> stestr --test-path=/home/zuul/src/opendev.org/openstack/tacker/tacker/tests/compliance --top-dir=/home/zuul/src/opendev.org/openstack/tacker run --slowest --concurrency 1 pid=30208 [tox/execute/api.py:275]
dsvm-compliance-sol-api: 44008 W commands_post[0] /home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api> rm -rf api-tests [tox/tox_env/api.py:428]
dsvm-compliance-sol-api: 44043 I exit 0 (0.03 seconds) /home/zuul/src/opendev.org/openstack/tacker/.tox/dsvm-compliance-sol-api> rm -rf api-tests pid=30240 [tox/execute/api.py:275]
.pkg: 44044 W _exit> python /usr/local/lib/python3.10/dist-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__ [tox/tox_env/api.py:428]
Backend: run command _exit with args {}
Backend: Wrote response {'return': 0} to /tmp/pep517__exit-u9qnqvzf.json
.pkg: 44046 I exit None (0.00 seconds) /home/zuul/src/opendev.org/openstack/tacker> python /usr/local/lib/python3.10/dist-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__ pid=29133 [tox/execute/api.py:275]
.pkg: 44119 D delete package /home/zuul/src/opendev.org/openstack/tacker/.tox/.tmp/package/2/tacker-9.1.0.dev8-0.editable-py3-none-any.whl [tox/tox_env/python/virtual_env/package/pyproject.py:179]
dsvm-compliance-sol-api: FAIL code 1 (43.59=setup[4.50]+cmd[19.69,0.19,18.43,0.75,0.03] seconds)
evaluation failed :( (44.00 seconds)
``` |
|