Re: Unit-testing in same file
- Posted by ArthurCrump Jul 27, 2012
- 1141 views
It is possible to test whether your file is executed directly instead of imported by checking the result of the function command_line().
The second element of the sequence returned by this function is the file that was executed.
If the second element of the result ends with your file name it was executed directly, not imported.