|
|
# Copyright (C) 2010-2023 RhodeCode GmbH
|
|
|
#
|
|
|
# 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/
|
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
|
|
|
|
pytest_plugins = [
|
|
|
"rhodecode.tests.fixtures.fixture_pyramid",
|
|
|
"rhodecode.tests.fixtures.fixture_utils",
|
|
|
"rhodecode.tests.fixtures.function_scoped_baseapp",
|
|
|
"rhodecode.tests.fixtures.module_scoped_baseapp",
|
|
|
"rhodecode.tests.fixtures.rcextensions_fixtures",
|
|
|
]
|
|
|
|
|
|
|
|
|
def pytest_configure(config):
|
|
|
from rhodecode.config import patches # noqa
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
# NOTE(marcink): custom test ordering, db tests and vcstests are slowest and should
|
|
|
# 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)
|
|
|
|