-
Notifications
You must be signed in to change notification settings - Fork 2
Skipping Tests
Tests can be skipped conditionally using the skipif
directive:
#VVT: skipif : python_expression
python_expression
is evaluated and cast to a bool
. If the result is True
the test will be skipped. For example
#VVT: skipif : sys.platform == "Darwin"
would skip the test if run on Apple hardware.
When a test is skipped, vvtest reports the reason as "python_expression evaluated to True"
. The reason
attribute can be supplied to provide a user defined reason for skipping. For example,
#VVT: skipif (reason=Test does not run on Apple hardware) : sys.platform == "Darwin"
A test may be skipped if a module is not importable by using the importable
function. importable(module_name)
evaluates to True
if module_name
can be imported otherwise, False
. For example,
#VVT: skipif : not importable("numpy")
would skip the test if numpy
was not available.
python_expression
is evaluated in a minimal namespace consisting of the os
module, sys
module, and importable
function.