Debian Codegraph @

python/dolfin_utils/test/skips.py

raw
1 # -*- coding: utf-8 -*-
2 """Shared skips for unit tests involving dolfin."""
3
4 # Copyright (C) 2014-2014 Aslak Wigdahl Bergersen
5 #
6 # This file is part of DOLFIN.
7 #
8 # DOLFIN is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # DOLFIN is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Lesser General Public License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
20
21 import pytest
22 from dolfin import *
23
24
25 # Skips with dependencies
26 skip_if_not_MPI = pytest.mark.skipif(not has_mpi(),
27 reason="Skipping unit test(s) depending on MPI.")
28 skip_if_not_PETsc_or_not_slepc = pytest.mark.skipif(not has_linear_algebra_backend("PETSc") or not has_slepc(),
29 reason='Skipping unit test(s) depending on PETSc and slepc.')
30 skip_if_not_HDF5 = pytest.mark.skipif(not has_hdf5(),
31 reason="Skipping unit test(s) depending on HDF5.")
32 skip_if_not_PETSc = pytest.mark.skipif(not has_linear_algebra_backend("PETSc"),
33 reason="Skipping unit test(s) depending on PETSc.")
34 skip_if_not_petsc4py = pytest.mark.skipif(not has_petsc4py(),
35 reason="Skipping unit test(s) depending on petsc4py.")
36 skip_if_not_SLEPc = pytest.mark.skipif(not has_slepc(),
37 reason="Skipping unit test(s) depending on SLEPc.")
38 skip_if_not_SUNDIALS = pytest.mark.skipif(not has_sundials(),
39 reason="Skipping unit test(s) depending on SUNDIALS.")
40
41 # Skips with respect to parallel or serial
42 xfail_in_parallel = pytest.mark.xfail(MPI.size(MPI.comm_world) > 1,
43 reason="This test does not yet work in parallel.")
44 xfail_with_serial_hdf5_in_parallel = pytest.mark.xfail(MPI.size(MPI.comm_world) > 1 and not has_hdf5_parallel(),
45 reason="Serial HDF5 library cannot work in parallel.")
46 skip_in_parallel = pytest.mark.skipif(MPI.size(MPI.comm_world) > 1,
47 reason="This test should only be run in serial.")
48 skip_with_serial_hdf5_in_parallel = pytest.mark.skipif(MPI.size(MPI.comm_world) > 1 and not has_hdf5_parallel(),
49 reason="Serial HDF5 library cannot work in parallel.")
50 skip_in_serial = pytest.mark.skipif(MPI.size(MPI.comm_world) <= 1,
51 reason="This test should only be run in parallel.")
52
53 # Skips with respect to linear algebra index type
54 skip_64bit_int = pytest.mark.skipif(cpp.common.sizeof_la_index() == 8,
55 reason="This test does not work with 64-bit linear algebra indices.")
56
57 # Skips with respect to build type
58 skip_in_debug = pytest.mark.skipif(has_debug(),
59 reason="This test does not work in debug mode.")
60 skip_in_release = pytest.mark.skipif(not has_debug(),
61 reason="This test does not work in release mode.")