conftest.py
57 lines
| 1.9 KiB
| text/x-python
|
PythonLexer
r5088 | # Copyright (C) 2010-2023 RhodeCode GmbH | |||
r5015 | # | |||
# This program is free software: you can redistribute it and/or modify | ||||
# it under the terms of the GNU Affero General Public License, version 3 | ||||
# (only), as published by the Free Software Foundation. | ||||
# | ||||
# 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 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/>. | ||||
# | ||||
# This program is dual-licensed. If you wish to learn more about the | ||||
# RhodeCode Enterprise Edition, including its added features, Support services, | ||||
# and proprietary license terms, please see https://rhodecode.com/licenses/ | ||||
r5087 | import pytest # noqa | |||
# keep the imports to have a toplevel conftest.py but still importable from EE edition | ||||
from rhodecode.tests.conftest_common import ( # noqa | ||||
pytest_generate_tests, | ||||
pytest_runtest_makereport, | ||||
pytest_addoption | ||||
) | ||||
r5015 | ||||
pytest_plugins = [ | ||||
"rhodecode.tests.fixture_mods.fixture_pyramid", | ||||
"rhodecode.tests.fixture_mods.fixture_utils", | ||||
] | ||||
def pytest_configure(config): | ||||
r5087 | from rhodecode.config import patches # noqa | |||
r5015 | ||||
def pytest_collection_modifyitems(session, config, items): | ||||
# nottest marked, compare nose, used for transition from nose to pytest | ||||
remaining = [ | ||||
i for i in items if getattr(i.obj, '__test__', True)] | ||||
items[:] = remaining | ||||
r5087 | # NOTE(marcink): custom test ordering, db tests and vcstests are slowest and should | |||
r5015 | # be executed at the end for faster test feedback | |||
def sorter(item): | ||||
pos = 0 | ||||
key = item._nodeid | ||||
if key.startswith('rhodecode/tests/database'): | ||||
pos = 1 | ||||
elif key.startswith('rhodecode/tests/vcs_operations'): | ||||
pos = 2 | ||||
return pos | ||||
items.sort(key=sorter) | ||||