case.skip

case.skip.todo(reason)[source]

Skip test flagging case as TODO.

Example:

@skip.todo(reason='broken test')
case.skip.if_darwin()[source]

Skip test if running under OS X.

Example:

@skip.if_darwin()
case.skip.unless_darwin()[source]

Skip test if not running under OS X.

case.skip.if_environ(env_var_name)[source]

Skip test if environment variable env_var_name is defined.

Example:

@skip.if_environ('SKIP_SLOW_TESTS')
case.skip.unless_environ(env_var_name)[source]

Skip test if environment variable env_var_name is undefined.

Example:

@skip.unless_environ('LOCALE')
case.skip.if_module(module, name=None, import_errors=(<type 'exceptions.ImportError'>, ))[source]

Skip test if module can be imported.

Parameters:
  • module – Module to import.
  • name – Alternative module name to use in reason.
  • import_errors – Tuple of import errors to check for. Default is (ImportError,).

Example:

@skip.if_module('librabbitmq')
case.skip.unless_module(module, name=None, import_errors=(<type 'exceptions.ImportError'>, ))[source]

Skip test if module can not be imported.

Parameters:
  • module – Module to import.
  • name – Alternative module name to use in reason.
  • import_errors – Tuple of import errors to check for. Default is (ImportError,).

Example:

@skip.unless_module('librabbitmq')
case.skip.if_jython()[source]

Skip test if running under Jython.

Example:

@skip.if_jython()
case.skip.unless_jython()[source]

Skip test if not running under Jython.

case.skip.if_platform(platform_name, name=None)[source]

Skip test if sys.platform name matches platform_name.

Parameters:
  • platform_name – Name to match with sys.platform.
  • name – Alternative name to use in reason.

Example:

@skip.if_platform('netbsd', name='NetBSD')
case.skip.unless_platform(platform_name, name=None)[source]

Skip test if sys.platform name does not match platform_name.

Parameters:
  • platform_name – Name to match with sys.platform.
  • name – Alternative name to use in reason.

Example:

@skip.unless_platform('netbsd', name='NetBSD')
case.skip.if_pypy(reason=u'does not work on PyPy')[source]

Skip test if running on PyPy.

Example:

@skip.if_pypy()
case.skip.unless_pypy(reason=u'only applicable for PyPy')[source]

Skip test if not running on PyPy.

Example:

@skip.unless_pypy()
case.skip.if_python3(*version, **kwargs)[source]

Skip test if Python version is 3 or later.

Example:

@skip.if_python3(reason='does not have buffer type')
case.skip.unless_python3(*version, **kwargs)[source]

Skip test if Python version is Python 2 or earlier.

Example:

@skip.unless_python3()
case.skip.if_win32()[source]

Skip test if running under Windows.

Example:

@skip.if_win32()
case.skip.unless_win32()[source]

Skip test if not running under Windows.

case.skip.if_symbol(symbol, name=None, import_errors=(<type 'exceptions.AttributeError'>, <type 'exceptions.ImportError'>))[source]

Skip test if symbol can be imported.

Parameters:
  • module – Symbol to import.
  • name – Alternative symbol name to use in reason.
  • import_errors – Tuple of import errors to check for. Default is (AttributeError, ImportError,).

Example:

@skip.if_symbol('django.db.transaction:on_commit')
case.skip.unless_symbol(symbol, name=None, import_errors=(<type 'exceptions.AttributeError'>, <type 'exceptions.ImportError'>))[source]

Skip test if symbol cannot be imported.

Parameters:
  • module – Symbol to import.
  • name – Alternative symbol name to use in reason.
  • import_errors – Tuple of import errors to check for. Default is (AttributeError, ImportError,).

Example:

@skip.unless_symbol('django.db.transaction:on_commit')
case.skip.if_python_version_after(*version, **kwargs)[source]

Skip test if Python version is greater or equal to *version.

Example:

# skips test if running on Python >= 3.5
@skip.if_python_version_after(3, 5)
case.skip.if_python_version_before(*version, **kwargs)[source]

Skip test if Python version is less than *version.

Example:

# skips test if running on Python < 3.1
@skip.if_python_version_before(3, 1)