[Bug 1814890] Re: Unit tests are not passing under python3.7

Corey Bryant 1814890 at bugs.launchpad.net
Tue Jul 20 12:41:12 UTC 2021


** Also affects: python-magnumclient (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: python-magnumclient (Ubuntu Focal)
   Importance: Undecided
       Status: New

** Changed in: python-magnumclient (Ubuntu)
       Status: New => Fix Released

** Changed in: python-magnumclient (Ubuntu Focal)
       Status: New => Triaged

** Changed in: python-magnumclient (Ubuntu Focal)
   Importance: Undecided => High

-- 
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:
  Triaged

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/

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