calling subTest method fails the test

Bug #1742343 reported by Bar Elharar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
New
Undecided
Unassigned

Bug Description

Context: While testtools has seen its last meaningful update in April 2017, as of early 2018, osc_lib TestCase class is still based on it.

Missing feature: subTest method - introduced in Python v3.4. As for osc-lib 1.8, calling this method fails for both PY2.7 (as expected) and for PY3.5 (due to testtools bug).

The purpose of subTest method is to add useful information in case of a test failure, otherwise, it has no influence on the test logic. Even if subTest fails to cast its magic, it shouldn't get in the way of a test from running as expected.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to osc-lib (master)

Reviewed: https://review.openstack.org/531025
Committed: https://git.openstack.org/cgit/openstack/osc-lib/commit/?id=2b74586d3c9b3dff9e4993cadf5a7a6ad92d744f
Submitter: Zuul
Branch: master

commit 2b74586d3c9b3dff9e4993cadf5a7a6ad92d744f
Author: Bar Elharar <email address hidden>
Date: Wed Jan 3 23:55:12 2018 +0200

    Suppress subTest() expected errors

    Prior to this patch, calling subTest from a test inside a class
    that inherits from osc_lib.TestCase would have failed the test.
    This failure is either due to lack of support prior to PY3.4 [1], or
    long-standing bug in testtools repo [2] which TestCase inherits from.

    The patch suppresses both errors, so to allow writing better tests
    using subTest, despite the fact that it is currently broken.

    [1] - https://docs.python.org/3/whatsnew/3.4.html#unittest
    [2] - https://bugs.launchpad.net/testtools/+bug/1219404

    Partial-Bug: #1742343

    Change-Id: I56bb3501d7a33fcec4fd971b2d9685d113e0af43

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.