requests-mock 1.7.0 breaks keystoneauth unit tests

Bug #1842978 reported by Lance Bragstad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
keystoneauth
Fix Released
Medium
Colleen Murphy

Bug Description

keystoneauth uses requests-mock for unit tests, but it breaks with version 1.7.0 [0].

==============================
Failed 1 tests - output below:
==============================

keystoneauth1.tests.unit.test_session.SessionAuthTests.test_logger_object_passed
--------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/opt/stack/keystoneauth/keystoneauth1/tests/unit/test_session.py", line 1202, in test_logger_object_passed'
    b' self.assertNotIn(self.TEST_URL, self.logger.output)'
    b' File "/opt/stack/keystoneauth/.tox/py37/lib/python3.7/site-packages/testtools/testcase.py", line 455, in assertNotIn'
    b' self.assertThat(haystack, matcher, message)'
    b' File "/opt/stack/keystoneauth/.tox/py37/lib/python3.7/site-packages/testtools/testcase.py", line 498, in assertThat'
    b' raise mismatch_error'
    b"testtools.matchers._impl.MismatchError: 'GET http://127.0.0.1:5000/ 200\\n' matches Contains('http://127.0.0.1:5000/')"
    b''

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
    b'GET http://127.0.0.1:5000/ 200'
    b''

The regression was introduced with a logging change to request-mock [1]. Keystoneauth will likely need to refactor those tests in order to adopt version 1.7.0. You can reproduce this by:

$ .tox/py37/bin/pip install -U requests-mock===1.7.0
$ tox -e py37

[0] https://pasted.tech/pastes/a80f649ab9e7141484edf473bd00c6a1b50f9366.raw
[1] https://github.com/jamielennox/requests-mock/pull/93

Changed in keystoneauth:
status: New → Confirmed
status: Confirmed → Triaged
importance: Undecided → Medium
Changed in keystoneauth:
assignee: nobody → Colleen Murphy (krinkle)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystoneauth (master)

Reviewed: https://review.opendev.org/680515
Committed: https://git.openstack.org/cgit/openstack/keystoneauth/commit/?id=8b06c57292753e920aac9407a2fa9659adb5c307
Submitter: Zuul
Branch: master

commit 8b06c57292753e920aac9407a2fa9659adb5c307
Author: Colleen Murphy <email address hidden>
Date: Thu Sep 5 13:46:35 2019 -0700

    Simplify session logger object tests

    With the requests-mock logger now configured to log the request[1],
    checking that the logger output does *not* contain the request is
    invalid. Simplify these two tests by omitting the assertion.

    [1] https://github.com/jamielennox/requests-mock/pull/93

    Closes-bug: #1842978

    Change-Id: If3c0447502917bce831d3e9f7ae4c31374dd4380

Changed in keystoneauth:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystoneauth 3.17.1

This issue was fixed in the openstack/keystoneauth 3.17.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.