# Copyright (C) 2023 C-PAC Developers# This file is part of C-PAC.# C-PAC 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.# C-PAC 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 C-PAC. If not, see <https://www.gnu.org/licenses/>."""Utilities for Pytest integration"""try:importpytestHAVE_PYTEST=TrueexceptImportError:HAVE_PYTEST=False
[docs]defskipif(condition,reason):"""Skip test if we have Pytest, ignore test entirely if not"""defdecorator(func):"""Skip test if we have Pytest"""ifHAVE_PYTEST:returnpytest.mark.skipif(condition,reason)(func)returnfunc# return undecorated functionreturndecorator# return conditionally decorated function