before this change, `setattr()` sets the instance specialized with a certain method
of test case, so in `MgrTestCase.setUpClass()`
assert cls.mgr_cluster is not None
fails,
after this change, instead of test case, the class of test suite is updated with the
specified params, even if we pass a certain test to test runner.
so we can
./run-backend-api-tests.sh tasks.mgr.test_dashboard.TestDashboard.test_standby
now. before this change, we can only:
./run-backend-api-tests.sh tasks.mgr.test_dashboard.TestDashboard
Signed-off-by: Kefu Chai <kchai@redhat.com>
def _apply_params(self, obj):
for k, v in self._params.items():
- setattr(obj, k, v)
+ if obj.__class__ is type:
+ cls = obj
+ else:
+ cls = obj.__class__
+ setattr(cls, k, v)
def loadTestsFromTestCase(self, testCaseClass):
self._apply_params(testCaseClass)