lundi 23 février 2015

Python, unittest: how to avoid running import module tests?

I have a module A with a unittest.main() after an if checking it is the main file:


if __name__ == '__main__': unittest.main()


However, when I import this module A to another module B (which also has such a main statement), the tests of the imported module A also get executed. How do I avoid this?


Aucun commentaire:

Enregistrer un commentaire