Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nocontext_tests.py 945B

12345678910111213141516171819202122232425262728293031323334353637
  1. #-*- coding: utf-8 -*-
  2. ##@brief Loader for tests which do not need an lodel installation
  3. #
  4. # Options
  5. ################
  6. #
  7. # @note We can pass the path to a directory to write results file, nocontext_tests.log
  8. # It has to be at first, otherwise it will not be taken
  9. # and the default one, current directory, will be used.
  10. # The results are not displayed, only stored in nocontext_tests.log
  11. #
  12. # -f, --failfast
  13. #
  14. # Stop the test run on the first error or failure.
  15. # -v --verbose
  16. #
  17. # higher verbosity
  18. #
  19. #
  20. import sys, os, os.path
  21. import unittest
  22. loader = unittest.TestLoader()
  23. if ((len(sys.argv) > 1) and (sys.argv[1].startswith('-')) is False):
  24. dpath = sys.argv[1]
  25. else:
  26. dpath = '.'
  27. suite = loader.discover('tests', pattern='nc_test*.py')
  28. with open(dpath+'/nocontext_tests.log', 'w') as logfile:
  29. unittest.TextTestRunner(
  30. logfile,
  31. failfast = '-f' in sys.argv,
  32. verbosity = 2 if '-v' in sys.argv else 1).run(suite)