PageRenderTime 25ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/main.py

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