dev_skip_test.py 1003 B

12345678910111213141516171819202122232425262728293031323334
  1. """
  2. Determine when dev tests should be skipped by regular users.
  3. Some tests are only intended to be tested during development right
  4. before performing a release. These do not test core functionality
  5. of `cytoolz` and may be skipped. These tests are only run if the
  6. following conditions are true:
  7. - toolz is installed
  8. - toolz is the correct version
  9. - cytoolz is a release version
  10. """
  11. import cytoolz
  12. try:
  13. from nose.tools import nottest, istest
  14. except ImportError:
  15. istest = lambda func: setattr(func, '__test__', True) or func
  16. nottest = lambda func: setattr(func, '__test__', False) or func
  17. try:
  18. import toolz
  19. do_toolz_tests = True
  20. except ImportError:
  21. do_toolz_tests = False
  22. if do_toolz_tests:
  23. do_toolz_tests = cytoolz.__toolz_version__ == toolz.__version__
  24. do_toolz_tests &= 'dev' not in cytoolz.__version__
  25. # Decorator used to skip tests for developmental versions of CyToolz
  26. if do_toolz_tests:
  27. dev_skip_test = istest
  28. else:
  29. dev_skip_test = nottest