unittest tests reuse for family of classes

Posted by zaharpopov on Stack Overflow See other posts from Stack Overflow or by zaharpopov
Published on 2010-03-28T07:30:15Z Indexed on 2010/03/28 7:33 UTC
Read the original article Hit count: 470

Filed under:
|
|

I have problem organizing my unittest based class test for family of tests. For example assume I implement a "dictionary" interface, and have 5 different implementations want to testing.

I do write one test class that tests a dictionary interface. But how can I nicely reuse it to test my all classes? So far I do ugly:

DictType = hashtable.HashDict

In top of file and then use DictType in test class. To test another class I manually change the DictType to something else.

How can do this otherwise? Can't pass arguments to unittest classes so is there a nicer way?

© Stack Overflow or respective owner

Related posts about python

Related posts about unit-testing