[Bug 1814890] Re: Unit tests are not passing under python3.7
Michal Arbet
1814890 at bugs.launchpad.net
Thu Nov 4 11:02:07 UTC 2021
+ it is merged master long time ago, this is really proper fix and
should be included in ubuntu.
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-magnumclient in Ubuntu.
https://bugs.launchpad.net/bugs/1814890
Title:
Unit tests are not passing under python3.7
Status in python-magnumclient:
Fix Released
Status in python-magnumclient package in Ubuntu:
Fix Released
Status in python-magnumclient source package in Focal:
Fix Committed
Bug description:
Hi,
I'm packaging packages for debian and found that unit tests are
failing under py37.
Request to create cluster 3a369884-b6ba-484f-a206-919b4b718aff
accepted
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_success_body_json
magnumclient.tests.test_httpclient.HttpClientTest.test_server_success_body_json
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 347, in test_server_success_body_json
resp, body = client.json_request('GET', '/v1/resources')
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_msg_only
magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_msg_only
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 109, in test_server_exception_msg_only
'GET', '/v1/resources')
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 485, in assertRaises
self.assertThat(our_callable, matcher)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 496, in assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 547, in _matchHelper
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 108, in match
mismatch = self.exception_matcher.match(exc_info)
File "/usr/lib/python3/dist-packages/testtools/matchers/_higherorder.py", line 62, in match
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 475, in match
reraise(*matchee)
File "/usr/lib/python3/dist-packages/testtools/_compat3x.py", line 16, in reraise
raise exc_obj.with_traceback(exc_tb)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 101, in match
result = matchee()
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 1049, in __call__
return self._callable_object(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_empty_body
magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_empty_body
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 93, in test_server_exception_empty_body
'GET', '/v1/resources')
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 485, in assertRaises
self.assertThat(our_callable, matcher)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 496, in assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 547, in _matchHelper
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 108, in match
mismatch = self.exception_matcher.match(exc_info)
File "/usr/lib/python3/dist-packages/testtools/matchers/_higherorder.py", line 62, in match
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 475, in match
reraise(*matchee)
File "/usr/lib/python3/dist-packages/testtools/_compat3x.py", line 16, in reraise
raise exc_obj.with_traceback(exc_tb)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 101, in match
result = matchee()
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 1049, in __call__
return self._callable_object(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_body_undecode_json
magnumclient.tests.test_httpclient.HttpClientTest.test_server_body_undecode_json
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 307, in test_server_body_undecode_json
resp, body = client.json_request('GET', '/v1/resources')
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_success_body_none
magnumclient.tests.test_httpclient.HttpClientTest.test_server_success_body_none
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 333, in test_server_success_body_none
resp, body = client.json_request('GET', '/v1/resources')
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_msg_and_traceback
magnumclient.tests.test_httpclient.HttpClientTest.test_server_exception_msg_and_traceback
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 128, in test_server_exception_msg_and_traceback
'GET', '/v1/resources')
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 485, in assertRaises
self.assertThat(our_callable, matcher)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 496, in assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 547, in _matchHelper
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 108, in match
mismatch = self.exception_matcher.match(exc_info)
File "/usr/lib/python3/dist-packages/testtools/matchers/_higherorder.py", line 62, in match
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 475, in match
reraise(*matchee)
File "/usr/lib/python3/dist-packages/testtools/_compat3x.py", line 16, in reraise
raise exc_obj.with_traceback(exc_tb)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 101, in match
result = matchee()
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 1049, in __call__
return self._callable_object(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
======================================================================
FAIL: magnumclient.tests.test_httpclient.HttpClientTest.test_401_unauthorized_exception
magnumclient.tests.test_httpclient.HttpClientTest.test_401_unauthorized_exception
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 409, in __iter__
yield self.next()
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 421, in next
raise StopIteration()
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/magnumclient/tests/test_httpclient.py", line 281, in test_401_unauthorized_exception
'GET', '/v1/resources')
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 485, in assertRaises
self.assertThat(our_callable, matcher)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 496, in assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 547, in _matchHelper
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 108, in match
mismatch = self.exception_matcher.match(exc_info)
File "/usr/lib/python3/dist-packages/testtools/matchers/_higherorder.py", line 62, in match
mismatch = matcher.match(matchee)
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 475, in match
reraise(*matchee)
File "/usr/lib/python3/dist-packages/testtools/_compat3x.py", line 16, in reraise
raise exc_obj.with_traceback(exc_tb)
File "/usr/lib/python3/dist-packages/testtools/matchers/_exception.py", line 101, in match
result = matchee()
File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 1049, in __call__
return self._callable_object(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 233, in json_request
resp, body_iter = self._http_request(url, method, **kwargs)
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 203, in _http_request
else chunk for chunk in body_iter
File "/<<PKGBUILDDIR>>/magnumclient/common/httpclient.py", line 202, in <listcomp>
chunk.decode("utf-8") if isinstance(chunk, bytes)
RuntimeError: generator raised StopIteration
----------------------------------------------------------------------
Ran 454 tests in 4.101s
This can be fixed by replacing StopIteration with return as it is in
pep:
https://www.python.org/dev/peps/pep-0479/
[Description]
See above
[Test Case]
This can be verified by the unit tests that are run during package build. As part of this change we've re-enabled the failing unit tests.
[Regression Potential]
A regression could surface as an unhandled exception in the python client code causing the client to crash. This is mitigated signficantly by the unit testing that is in place for this test.
[Discussion]
SRU team, please consider the most recent upload in the focal unapproved queue which has re-enabled the failing unit tests (ie. it drops skip-test.patch).
https://launchpad.net/ubuntu/focal/+queue?queue_state=1&queue_text=python-magnumclient
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-magnumclient/+bug/1814890/+subscriptions
More information about the Ubuntu-openstack-bugs
mailing list