dev_skip_test.py 1.0 KB

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 sys
  12. import cytoolz
  13. istest = lambda func: setattr(func, '__test__', True) or func
  14. nottest = lambda func: setattr(func, '__test__', False) or func
  15. try:
  16. import toolz
  17. do_toolz_tests = True
  18. except ImportError:
  19. do_toolz_tests = False
  20. if do_toolz_tests:
  21. do_toolz_tests = toolz.__version__.startswith(cytoolz.__toolz_version__)
  22. do_toolz_tests &= '+' not in cytoolz.__version__
  23. # Decorator used to skip tests for developmental versions of CyToolz.
  24. # Also, skip these tests on PyPy, which may handle docs differently.
  25. if do_toolz_tests and sys.implementation.name != "pypy":
  26. dev_skip_test = istest
  27. else:
  28. dev_skip_test = nottest