utils.py 527 B

1234567891011121314151617
  1. import unittest
  2. import sys
  3. from os.path import isfile, isdir, exists, dirname
  4. test_dir = dirname(__file__)
  5. def skip_on_windows(function):
  6. """Decorator to skip a test on Windows."""
  7. return unittest.skipIf(sys.platform.startswith("win"),
  8. "Test for non-Windows platforms")(function)
  9. def only_on_windows(function):
  10. """Decorator to skip a test on Windows."""
  11. return unittest.skipUnless(sys.platform.startswith("win"),
  12. "Test requires Windows")(function)