So I'm creating unit tests for all of my scripts, many of which arent oo, and have main-loop code. I was wondering what the standard is for the location of creating unittest classes in relation to the affected script. Should the unit test be in a separate file which imports the script, and then function-alize the mainloop code? Or can it shoved at the end of the the related script?
One additional reason for not putting the unit tests in source file is that during distribution/packaging of your python application you can exclude all the directories that contains the tests.
Putting unittest classes in the related script itself vs making a separate file