Unit tests fail in OSP 17 CI: 2022-02-28 07:28:38.759990 | container | Captured traceback: 2022-02-28 07:28:38.759996 | container | ~~~~~~~~~~~~~~~~~~~ 2022-02-28 07:28:38.760003 | container | Traceback (most recent call last): 2022-02-28 07:28:38.760009 | container | 2022-02-28 07:28:38.760015 | container | File "/root/src/.../python-neutronclient/neutronclient/tests/unit/test_cli20.py", line 1214, in test_list_resources_yaml 2022-02-28 07:28:38.760021 | container | data = yaml.load(''.join(self.fake_stdout.content)) 2022-02-28 07:28:38.760028 | container | 2022-02-28 07:28:38.760034 | container | TypeError: load() missing 1 required positional argument: 'Loader' 2022-02-28 07:28:38.760048 | container | 2022-02-28 07:28:38.760054 | container | 2022-02-28 07:28:38.760060 | container | neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter.test_show_resource_yaml 2022-02-28 07:28:38.760075 | container | ------------------------------------------------------------------------------------- To reproduce: 1. Clone the project 2. Checkout OSP 17 branch 3. Run unit tests (py39)
There are two types of failures happening in the python-neutronclient unit tests: 1) "load() missing 1 required positional argument: 'Loader'" with some test cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The problem is that PyYAML yaml.load() requires now a second argument, 'Loader'. This was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it wasn't backported to Wallaby. This is because in upstream Wallaby the unit tests are executed in a py38 environment: https://github.com/openstack/python-neutronclient/blob/c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML in this py38 environment had deprecated calling yaml.load() without the second argument 'Loader', but still supported it. That is not the case in py39, which is what we are using downstream to run these tests. 2) "AttributeError: module 'testtools.helpers' has no attribute 'safe_hasattr'" with some test cases in neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in this case is that testtools 2.5.0 removed the utility function 'safe_hasattr' as explained here: https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the problem was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it wasn't backported to Wallaby. So, again, we find this issue because we are running these test cases in a py39 environment, whereas upstream Wallaby uses a py38 environment. So the question here is why don't we align ourselves with upstream and run these unit tests in a py38 environment?
(In reply to Miguel Lavalle from comment #2) > There are two types of failures happening in the python-neutronclient unit > tests: > > 1) "load() missing 1 required positional argument: 'Loader'" with some test > cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The > problem is that PyYAML yaml.load() requires now a second argument, 'Loader'. > This was fixed in upstream master with > https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it > wasn't backported to Wallaby. This is because in upstream Wallaby the unit > tests are executed in a py38 environment: > https://github.com/openstack/python-neutronclient/blob/ > c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML > in this py38 environment had deprecated calling yaml.load() without the > second argument 'Loader', but still supported it. That is not the case in > py39, which is what we are using downstream to run these tests. > > 2) "AttributeError: module 'testtools.helpers' has no attribute > 'safe_hasattr'" with some test cases in > neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in > this case is that testtools 2.5.0 removed the utility function > 'safe_hasattr' as explained here: > https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the > problem was fixed in upstream master with > https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it > wasn't backported to Wallaby. So, again, we find this issue because we are > running these test cases in a py39 environment, whereas upstream Wallaby > uses a py38 environment. > > So the question here is why don't we align ourselves with upstream and run > these unit tests in a py38 environment? We run the tests from OSP 17 branch, not Wallaby. OSP 17 as far as I know is going to be released using Python 3.9
Arie, Thanks for your response. I have started the back-porting of the necessary changes to the test cases upstream: https://review.opendev.org/c/openstack/python-neutronclient/+/834930 https://review.opendev.org/c/openstack/python-neutronclient/+/834942
wallaby backport is merged
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2022:6543