Find some way to make subtests work
Bug #1445552 reported by
Brian Curtin
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack SDK |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
If TestCase.subTest worked properly in all of our test dependencies, we would have much less duplication. Currently, coverage of delete tests requires two tests per delete call that flip a bool, which would be better off as one test that generated subtests for True/False. If the following diff worked, we'd be better off. There's something off in the versions of unittest2, subunit, and perhaps others, that are not allowing this to work. It's a Python 3.4 feature that was backported and apparently works differently with our test runner infrastructure.
Changed in python-openstacksdk: | |
status: | New → Confirmed |
importance: | Undecided → Wishlist |
milestone: | none → 1.0 |
tags: | added: testing |
Changed in python-openstacksdk: | |
milestone: | 1.0 → none |
To post a comment you must log in.
diff --git a/openstack/ tests/unit/ test_proxy_ base.py b/openstack/ tests/unit/ test_proxy_ base.py tests/unit/ test_proxy_ base.py tests/unit/ test_proxy_ base.py base.TestCase) :
self. _verify( mock_method, test_method, **kwargs)
index e315a7d..10b2e94 100644
--- a/openstack/
+++ b/openstack/
@@ -76,12 +76,14 @@ class TestProxyBase(
def verify_delete(self, mock_method, test_method, **kwargs):
- def verify_ delete2( self, resource, method, ignore): 'openstack. proxy.BaseProxy ._delete' , args=[" resource_ or_id"] , kwargs= {"ignore_ missing" : ignore}, args=[resource, "resource_or_id", ignore]) delete2( self, resource, method): ignore= ignore) : 'openstack. proxy.BaseProxy ._delete' , method, args=[" resource_ or_id"] , kwargs= {"ignore_ missing" : ignore}, args=[resource, "resource_or_id",
- self._verify2(
- method,
- method_
- method_
- expected_
+ def verify_
+ for ignore in (True, False):
+ with self.subTest(
+ self._verify2(
+ method_
+ method_
+ expected_
+ ignore])
def verify_get(self, mock_method, test_method, **kwargs):
self. _verify( mock_method, test_method, expected_ result= "result" ,