Merge "tests: Resolve TODO"
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import contextlib
|
|
||||||
import copy
|
import copy
|
||||||
import json as jsonutils
|
import json as jsonutils
|
||||||
import os
|
import os
|
||||||
@@ -111,24 +110,6 @@ class TestCase(testtools.TestCase):
|
|||||||
msg = f'method {m} should not have been called'
|
msg = f'method {m} should not have been called'
|
||||||
self.fail(msg)
|
self.fail(msg)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
|
||||||
def subTest(self, *args, **kwargs):
|
|
||||||
"""This is a wrapper to unittest's subTest method.
|
|
||||||
|
|
||||||
This wrapper suppresses 2 issues:
|
|
||||||
* lack of support in older Python versions
|
|
||||||
* bug in testtools that breaks support for all versions
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with super().subTest(*args, **kwargs):
|
|
||||||
yield
|
|
||||||
except TypeError:
|
|
||||||
raise
|
|
||||||
except AttributeError:
|
|
||||||
# TODO(elhararb): remove this except clause when subTest is
|
|
||||||
# enabled in testtools
|
|
||||||
yield
|
|
||||||
|
|
||||||
|
|
||||||
class TestCommand(TestCase):
|
class TestCommand(TestCase):
|
||||||
"""Test cliff command classes"""
|
"""Test cliff command classes"""
|
||||||
|
|||||||
Reference in New Issue
Block a user