Skip to content

"Mapping" import error occurs in using Python 3.10 and higher

When we try to install api-tests into the environment which Python version is higher than 3.9, the following import error occurs.

importerror: cannot import name ‘mapping’ from ‘collections’

In our analysis, it is found that "Mapping" class has been moved into "collections.abc" class in higher version such as Python 3.10.

On the other hand, existing each branch of api-tests imports "robotframework" version 3.1 according to requirements.txt [1].

The v3.1 of robotframework imports Mapping from collections [2], so this error happens as long as we uses both robotframework v3.1 and Python 3.9 and lower.

The v3.2 of robotframework has been updated to import Mapping from collections.abc [3] instead of collections.

To fix this issue, we need to upgrade robotframework version from v3.1 to v3.2 in requirements.txt.

Edited by Koichi Edagawa
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information