home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1915 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.2 KB  |  46 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import os
  5. import sys
  6. from IPython.testing.decorators import make_label_dec
  7.  
  8. def skipif(skip_condition, msg = None):
  9.     
  10.     def skip_decorator(f):
  11.         if msg is None:
  12.             out = 'Test skipped due to test condition.'
  13.         else:
  14.             out = msg
  15.         final_msg = 'Skipping test: %s. %s' % (f.__name__, out)
  16.         if skip_val():
  17.             f.skip = final_msg
  18.         
  19.         return f
  20.  
  21.     return skip_decorator
  22.  
  23.  
  24. def skip(msg = None):
  25.     return skipif(True, msg)
  26.  
  27.  
  28. def numpy_not_available():
  29.     
  30.     try:
  31.         import numpy
  32.         np_not_avail = False
  33.     except ImportError:
  34.         np_not_avail = True
  35.  
  36.     return np_not_avail
  37.  
  38. skip_win32 = skipif(sys.platform == 'win32', 'This test does not run under Windows')
  39. skip_linux = skipif(sys.platform == 'linux2', 'This test does not run under Linux')
  40. skip_osx = skipif(sys.platform == 'darwin', 'This test does not run under OS X')
  41. skip_if_not_win32 = skipif(sys.platform != 'win32', 'This test only runs under Windows')
  42. skip_if_not_linux = skipif(sys.platform != 'linux2', 'This test only runs under Linux')
  43. skip_if_not_osx = skipif(sys.platform != 'darwin', 'This test only runs under OSX')
  44. skipif_not_numpy = skipif(numpy_not_available, 'This test requires numpy')
  45. skipknownfailure = skip('This test is known to fail')
  46.