minimal test of 'cmdtest.py' used as module

This commit is contained in:
Johan Holmberg
2016-01-07 19:22:28 +01:00
parent a343141f30
commit 3baa2c5133
2 changed files with 52 additions and 0 deletions

18
python/t/as_module.py Executable file

@ -0,0 +1,18 @@
#!/usr/bin/env python3
import os
import sys
from os.path import dirname
# import from 'cmdtest.py' in other directory
sys.path.insert(0, dirname(dirname(os.path.abspath(__file__))))
from cmdtest import cmdtest_in_dir, Statistics
def main():
dirpath = sys.argv[1]
statistics = cmdtest_in_dir(dirpath)
print(statistics)
exit(0 if statistics.errors == 0 and statistics.fatals == 0 else 1)
if __name__ == '__main__':
main()