calling subTest method fails the test
Bug #1742343 reported by
Bar Elharar
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.
To post a comment you must log in.
Reviewed: https:/ /review. openstack. org/531025 /git.openstack. org/cgit/ openstack/ osc-lib/ commit/ ?id=2b74586d3c9 b3dff9e4993cadf 5a7a6ad92d744f
Committed: https:/
Submitter: Zuul
Branch: master
commit 2b74586d3c9b3df f9e4993cadf5a7a 6ad92d744f
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 /bugs.launchpad .net/testtools/ +bug/1219404
[2] - https:/
Partial-Bug: #1742343
Change-Id: I56bb3501d7a33f cec4fd971b2d968 5d113e0af43