authentic/tests_rbac/conftest.py

40 lines
1.2 KiB
Python

# authentic2 - versatile identity manager
# Copyright (C) 2010-2020 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
def pytest_addoption(parser):
parser.addoption(
"--slow",
action="store_true",
help="run slow tests",
)
def pytest_configure(config):
# register an additional marker
config.addinivalue_line(
"markers", "slow: mark test as slow"
)
def pytest_runtest_setup(item):
markers = list(item.iter_markers(name='slow'))
slow = item.config.getoption('--slow')
if markers and not slow:
pytest.skip('slow tests must not run')