1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
from .about import about
from .settings import settings as qset
def run(full=False, pytest_options=[]):
"""
Run the test scripts for QuTiP.
Parameters
----------
full: bool
If True run all test (30 min). Otherwise skip few variants of the
slowest tests.
pytest_options: list
List of extra command-line options to provide to pytest,
each provided as [option[,value]] items
e.g. pytest_options=[["--verbose"],["-k","not test_qubit"]]
"""
# Call about to get all version info printed with tests
about()
import pytest
# real_num_cpu = qset.num_cpus
# real_thresh = qset.openmp_thresh
# if qset.has_openmp:
# For travis which VMs have only 1 cpu.
# Make sure the openmp version of the functions are tested.
# qset.num_cpus = 2
# qset.openmp_thresh = 100
test_options = ["--verbosity=1", "--disable-pytest-warnings", "--pyargs"]
if not full:
test_options += ['-m', 'not slow']
for pyopt in pytest_options:
test_options += pyopt
pytest.main(test_options + ["qutip"])
# runs tests in qutip.tests module only
# Restore previous settings
# if qset.has_openmp:
# qset.num_cpus = real_num_cpu
# qset.openmp_thresh = real_thresh
|