I'm writing unit-tests for a python module module
, using python's unittest framework.
This module does a little "pre-proccessing" using a json file when it is loaded so it has things like:
module.info['xyz']
that can be accessed and used.
When writing tests for this I want to reload the module before every test so that for every test the older keys of the dictionary module.info
are no longer present before starting the current test.
Right now I have a reload(module)
in setUp()
but that doesn't seem to be doing the trick. I sitll have old keys introduced by test_A
in other tests such as test_B
and test_C
that are executed after it.
I'd like to know if there's a way to do what I'm trying to achieve, or if you can point me to documentation that says it can not be done.