On Wed, 12/20 18:49, Vladimir Sementsov-Ogievskiy wrote: > +def inject_test_case(klass, name, method, *args, **kwargs): > + mc = operator.methodcaller(method, *args, **kwargs) > + setattr(klass, 'test_' + name, new.instancemethod(mc, None, klass)) > + > + > +for cmb in list(itertools.product((True, False), repeat=4)): > + name = ('_' if cmb[0] else '_not_') + 'persistent_' > + name += ('_' if cmb[1] else '_not_') + 'shared_' > + name += ('_' if cmb[2] else '_not_') + 'migbitmap_' > + name += '_online' if cmb[3] else '_offline' > + > + inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration', > *cmb)
Personally I'd just spell out the 16 method names and call do_test_migration. It's much easier to read and modify. Either way, Reviewed-by: Fam Zheng <f...@redhat.com>