requires.should 517 Bytes
Newer Older
Mathieu Giraud's avatar
Mathieu Giraud committed
1 2
!OPTIONS: --var MIN_VERSION=(3,5)

3 4 5 6
# A !REQUIRES directive is executed before any test.
# The .should file is taken into account only if the !REQUIRES command exits with 0.
!REQUIRES: python3 -c "import sys; sys.exit(0 if sys.version_info >= $MIN_VERSION else 1)"

Mathieu Giraud's avatar
Mathieu Giraud committed
7
# Note that !REQUIRES directives may also use variables, defined above
8 9 10 11 12 13

# We test here a function that was introduced in Python 3.5.
python3 -c "import math; print(math.isclose(math.pi, 3.14, rel_tol=0.01))"

$ Correct output of math.isclose()
1: True