case.skip
¶
- 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.if_module(module, name=None, import_errors=(<class '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.if_platform(platform_name, name=None)[source]¶
Skip test if
sys.platform
name matchesplatform_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.if_pypy(reason='does not work on PyPy')[source]¶
Skip test if running on PyPy.
Example:
@skip.if_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.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)
- case.skip.if_symbol(symbol, name=None, import_errors=(<class 'AttributeError'>, <class '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.todo(reason)[source]¶
Skip test flagging case as TODO.
Example:
@skip.todo(reason='broken test')
- 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.unless_module(module, name=None, import_errors=(<class '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.unless_platform(platform_name, name=None)[source]¶
Skip test if
sys.platform
name does not matchplatform_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.unless_pypy(reason='only applicable for PyPy')[source]¶
Skip test if not running on PyPy.
Example:
@skip.unless_pypy()
- case.skip.unless_python3(*version, **kwargs)[source]¶
Skip test if Python version is Python 2 or earlier.
Example:
@skip.unless_python3()
- case.skip.unless_symbol(symbol, name=None, import_errors=(<class 'AttributeError'>, <class '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')