Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to using subunit.run instead of nose2
There seems to be a conflict between nose2's and neutron.test.base's handling of failed tests. They both have non-trivial code for intercepting assertion failures, and when test_dhcp_agent.py fails on this line: # Check DHCP driver was asked to restart. call_driver.assert_called_with('restart', mock.ANY) the result is that we get an exception from nose2's own code about not being able to use `join` with an argument that is not an iterable. Modifying the nose2 code at that point shows this: MODIFIED OUTPUT: test=<networking_calico.tests.test_dhcp_agent.TestDhcpAgent.test_mainline id=0x7fc780dd9a60> exctype=<class 'testtools.testresult.real._StringException'> value=_StringException(' Empty attachments: stdout Traceback (most recent call last): File "/code/.tox/py38/lib/python3.8/site-packages/neutron/tests/base.py", line 182, in func return f(self, *args, **kwargs) File "/code/networking_calico/tests/test_dhcp_agent.py", line 137, in test_mainline call_driver.assert_called_with(\'restart\', mock.ANY) File "/code/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 932, in assert_called_with raise AssertionError(error_message) AssertionError: expected call not found. Expected: call_driver(\'restart\', <ANY>) Actual: not called. ') tb=None It looks like nose2 expects direct access to the traceback, but neutron.test.base has already reformatted into a string form that nose2 can't handle. When we revert to using subunit.run, we get this useful failure output: FAIL: networking_calico.tests.test_dhcp_agent.TestDhcpAgent.test_mainline tags: worker-0 ---------------------------------------------------------------------- Traceback (most recent call last): File "/code/.tox/py38/lib/python3.8/site-packages/neutron/tests/base.py", line 182, in func return f(self, *args, **kwargs) File "/code/networking_calico/tests/test_dhcp_agent.py", line 137, in test_mainline call_driver.assert_called_with('restart', mock.ANY) File "/code/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 932, in assert_called_with raise AssertionError(error_message) AssertionError: expected call not found. Expected: call_driver('restart', <ANY>) Actual: not called. Obvious question: so why did I recently switch from subunit.run to nose2? I can't remember precisely, but I suspect it was a situation that has now been fixed in the more correct way by imposing all of the Ussuri release's constraints on Python packages.
- Loading branch information