If one has to test an addon, you want to build, unit-tests are great.
Wat do you want: You wright your assertions and test if they are OK or not, right?
If you find an error in you addon-source, you want to repair it and press “Run Script” again (you unittests namely) and without precausions it will not work, because the changed source is not read/loaded again. So the NOT WISHED remedy is: close Blender and open Blender again. AND THIS IS WHAT THIS thread is about!!!
In principle this is possible by using “import imp” and its imp.reload function!!
But in my Blender of yesterday compiled I get this strange behavior!
I did the following (all in the zip attachment!):
In the mainSource.py the class Rectangle is hidden as comment ==>
in the unittest Rectangle is used and gives (the expected) error message!
Removing in the source the ‘’’ (two times ) the test succeeds (as expected)
Again ‘’’ before and after’’’ running the test, the test succeeds and THIS IS TOTALLY unexpected???
What is the reason, how to change???
=======output of unittesting========
is in the zip …!!!
put the dir in addons dir and try youself, please
miniUnit.zip (3.62 KB)