The command to run the formatting tests for the keystone project is:
tox -e pe8
Running this on Fedora35 failed for me with this error:
ERROR: pep8: could not install deps [-chttps://releases.openstack.org/constraints/upper/master, -r/opt/stack/keystone/test-requirements.txt, .[ldap,memcache,mongodb]]; v = InvocationError("/opt/stack/keystone/.tox/pep8/bin/python -m pip install -chttps://releases.openstack.org/constraints/upper/master -r/opt/stack/keystone/test-requirements.txt '.[ldap,memcache,mongodb]'", 1) |
What gets swallowed up is the actual error in the install, and it has to do with the fact that the python dependencies are compiled against native libraries. If I activate the venv and run the command by hand, I can see the first failure. But if I look up at the previous output, I can see it, just buried a few screens up:
Error: pg_config executable not found. |
A Later error was due to the compile step erroring out looking for lber.h:
In file included from Modules/LDAPObject.c:3: Modules/common.h:15:10: fatal error: lber.h: No such file or directory 15 | #include <lber.h> | ^~~~~~~~ compilation terminated. error: command '/usr/bin/gcc' failed with exit code 1 |
To get the build to run, I need to install both libpq-devel and libldap-devel and now it fails like this:
File "/opt/stack/keystone/.tox/pep8/lib/python3.10/site-packages/pep257.py", line 24, in <module> from collections import defaultdict, namedtuple, Set ImportError: cannot import name 'Set' from 'collections' (/usr/lib64/python3.10/collections/__init__.py) |
This appears to be due to the version of python3 on my system (3.10) which is later than supported by upstream openstack. I do have python3.9 installed on my system, and can modify the tox.ini to use it by specifying the basepython version.
[testenv:pep8] basepython = python3.9 deps = |
And then I can run tox -e pep8.