/tests/main.py
Python | 29 lines | 19 code | 9 blank | 1 comment | 2 complexity | 98c02082a72f15840f860bdb4b5273b2 MD5 | raw file
1#!/usr/bin/env python 2 3import sys 4from types import ModuleType 5from os.path import abspath, dirname 6from subprocess import Popen, STDOUT 7 8 9def importable(module): 10 try: 11 m = __import__(module, globals(), locals()) 12 return type(m) is ModuleType 13 except ImportError: 14 return False 15 16 17def main(): 18 cmd = ["py.test", "-r", "fsxX", "--ignore=tmp"] 19 20 if importable("pytest_cov"): 21 cmd.append("--cov=circuits") 22 cmd.append("--cov-report=html") 23 24 cmd.append(dirname(abspath(__file__))) 25 26 raise SystemExit(Popen(cmd, stdout=sys.stdout, stderr=STDOUT).wait()) 27 28if __name__ == "__main__": 29 main()