Write your code on modules with different names. Writing new code to an existing file and attempting to import it will not work again.
Alternatively, you can clobber sys.modules . For instance:
class MyTestCase(unittest.TestCase): def setUp(self):
source share