File: skips.py

package info (click to toggle)
dolfin 2019.2.0~git20201207.b495043-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 30,988 kB
  • sloc: xml: 104,040; cpp: 102,020; python: 24,139; makefile: 300; javascript: 226; sh: 185
file content (61 lines) | stat: -rw-r--r-- 3,501 bytes parent folder | download | duplicates (5)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
"""Shared skips for unit tests involving dolfin."""

# Copyright (C) 2014-2014 Aslak Wigdahl Bergersen
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DOLFIN is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.

import pytest
from dolfin import *


# Skips with dependencies
skip_if_not_MPI = pytest.mark.skipif(not has_mpi(),
                                     reason="Skipping unit test(s) depending on MPI.")
skip_if_not_PETsc_or_not_slepc = pytest.mark.skipif(not has_linear_algebra_backend("PETSc") or not has_slepc(),
                                                    reason='Skipping unit test(s) depending on PETSc and slepc.')
skip_if_not_HDF5 = pytest.mark.skipif(not has_hdf5(),
                                      reason="Skipping unit test(s) depending on HDF5.")
skip_if_not_PETSc = pytest.mark.skipif(not has_linear_algebra_backend("PETSc"),
                                       reason="Skipping unit test(s) depending on PETSc.")
skip_if_not_petsc4py = pytest.mark.skipif(not has_petsc4py(),
                                          reason="Skipping unit test(s) depending on petsc4py.")
skip_if_not_SLEPc = pytest.mark.skipif(not has_slepc(),
                                       reason="Skipping unit test(s) depending on SLEPc.")
skip_if_not_SUNDIALS = pytest.mark.skipif(not has_sundials(),
                                          reason="Skipping unit test(s) depending on SUNDIALS.")

# Skips with respect to parallel or serial
xfail_in_parallel = pytest.mark.xfail(MPI.size(MPI.comm_world) > 1,
                                      reason="This test does not yet work in parallel.")
xfail_with_serial_hdf5_in_parallel = pytest.mark.xfail(MPI.size(MPI.comm_world) > 1 and not has_hdf5_parallel(),
                                                       reason="Serial HDF5 library cannot work in parallel.")
skip_in_parallel = pytest.mark.skipif(MPI.size(MPI.comm_world) > 1,
                                      reason="This test should only be run in serial.")
skip_with_serial_hdf5_in_parallel = pytest.mark.skipif(MPI.size(MPI.comm_world) > 1 and not has_hdf5_parallel(),
                                                       reason="Serial HDF5 library cannot work in parallel.")
skip_in_serial = pytest.mark.skipif(MPI.size(MPI.comm_world) <= 1,
                                    reason="This test should only be run in parallel.")

# Skips with respect to linear algebra index type
skip_64bit_int = pytest.mark.skipif(cpp.common.sizeof_la_index() == 8,
                                    reason="This test does not work with 64-bit linear algebra indices.")

# Skips with respect to build type
skip_in_debug = pytest.mark.skipif(has_debug(),
                                   reason="This test does not work in debug mode.")
skip_in_release = pytest.mark.skipif(not has_debug(),
                                     reason="This test does not work in release mode.")