pytest: use consistent way of creating a fixture by using pytest.fixture()
This commit is contained in:
parent
b0b489c367
commit
1d9452ce80
41 changed files with 105 additions and 106 deletions
|
|
@ -25,7 +25,7 @@ from rhodecode.model.scm import ScmModel
|
|||
from rhodecode.api.tests.utils import build_data, api_call, assert_ok
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def http_host_stub():
|
||||
"""
|
||||
To ensure that we can get an IP address, this test shall run with a
|
||||
|
|
|
|||
|
|
@ -412,14 +412,14 @@ class TestAdminSettingsVcs(object):
|
|||
setting = SettingsModel().get_setting_by_name(setting_key)
|
||||
assert setting.app_settings_value is new_value
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def disable_sql_cache(self, request):
|
||||
patcher = mock.patch(
|
||||
'rhodecode.lib.caching_query.FromCache.process_query')
|
||||
request.addfinalizer(patcher.stop)
|
||||
patcher.start()
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def form_defaults(self):
|
||||
from rhodecode.apps.admin.views.settings import AdminSettingsView
|
||||
return AdminSettingsView._form_defaults()
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class GistUtility(object):
|
|||
Session().commit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def create_gist(request):
|
||||
gist_utility = GistUtility()
|
||||
request.addfinalizer(gist_utility.cleanup)
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ def summary_view(context_stub, request_stub, user_util):
|
|||
@pytest.mark.usefixtures('app')
|
||||
class TestCreateReferenceData(object):
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def example_refs(self):
|
||||
section_1_refs = OrderedDict((('a', 'a_id'), ('b', 'b_id')))
|
||||
example_refs = [
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from rhodecode.apps.ssh_support.lib.ssh_wrapper import SshWrapper
|
|||
from rhodecode.lib.utils2 import AttributeDict
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def dummy_conf_file(tmpdir):
|
||||
conf = configparser.ConfigParser()
|
||||
conf.add_section('app:main')
|
||||
|
|
@ -48,7 +48,7 @@ def plain_dummy_env():
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def dummy_env():
|
||||
return plain_dummy_env()
|
||||
|
||||
|
|
@ -57,12 +57,12 @@ def plain_dummy_user():
|
|||
return AttributeDict(username='test_user')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def dummy_user():
|
||||
return plain_dummy_user()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def ssh_wrapper(app, dummy_conf_file, dummy_env):
|
||||
conn_info = '127.0.0.1 22 10.0.0.1 443'
|
||||
return SshWrapper(
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class GitServerCreator(object):
|
|||
return server
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def git_server(app):
|
||||
return GitServerCreator()
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class MercurialServerCreator(object):
|
|||
return server
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def hg_server(app):
|
||||
return MercurialServerCreator()
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class SubversionServerCreator(object):
|
|||
return server
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def svn_server(app):
|
||||
return SubversionServerCreator()
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ Please keep the following principles in mind:
|
|||
"""
|
||||
|
||||
|
||||
|
||||
def inspect_getargspec():
|
||||
"""
|
||||
Pyramid rely on inspect.getargspec to lookup the signature of
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import pytest
|
|||
from rhodecode.config import environment
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def _external_calls_patcher(request):
|
||||
# TODO: mikhail: This is a temporary solution. Ideally load_environment
|
||||
# should be split into multiple small testable functions.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def pytest_collection_modifyitems(session, config, items):
|
|||
items[:] = remaining
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def db_backend(
|
||||
request, db_backend_name, ini_config, tmpdir_factory):
|
||||
basetemp = tmpdir_factory.getbasetemp().strpath
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ from rhodecode.events.repo import (
|
|||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def scm_extras(user_regular, repo_stub):
|
||||
extras = utils2.AttributeDict({
|
||||
'ip': '127.0.0.1',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from rhodecode import events
|
|||
from rhodecode.lib.utils2 import AttributeDict
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo_push_event(backend, user_regular):
|
||||
commits = [
|
||||
{'message': 'ancestor commit fixes #15'},
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class TestDeleteScopesDeletesIntegrations(object):
|
|||
assert integration is None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def integration_repos(request, StubIntegrationType, stub_integration_settings):
|
||||
"""
|
||||
Create repositories and integrations for testing, and destroy them after
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from rhodecode.model.db import Session, Integration
|
|||
from rhodecode.integrations.types.slack import SlackIntegrationType
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def slack_settings():
|
||||
return {
|
||||
"service": "mock://slackintegration",
|
||||
|
|
@ -40,7 +40,7 @@ def slack_settings():
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def slack_integration(request, app, slack_settings):
|
||||
integration = Integration()
|
||||
integration.name = 'test slack integration'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from rhodecode.lib.utils2 import AttributeDict
|
|||
from rhodecode.integrations.types.webhook import WebhookDataHandler
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def base_data():
|
||||
return {
|
||||
'name': 'event',
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ def test_authenticate_migrates_to_new_hash(stub_auth_data):
|
|||
assert result == stub_auth_data
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_auth_data(user_util):
|
||||
user = user_util.create_user()
|
||||
data = {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class StubVCSController(simplevcs.SimpleVCS):
|
|||
return None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcscontroller(baseapp, config_stub, request_stub):
|
||||
config_stub.testing_securitypolicy()
|
||||
config_stub.include('rhodecode.authentication')
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def test_does_chunked_end_to_end_transfer(scm_app):
|
|||
assert times[1] - times[0] > 0.1, "Chunks arrived at the same time"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def echo_app_chunking(request, available_port_factory):
|
||||
"""
|
||||
Run the EchoApp via Waitress in a subprocess.
|
||||
|
|
@ -63,7 +63,7 @@ def echo_app_chunking(request, available_port_factory):
|
|||
return echo_app_url
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def scm_app(request, available_port_factory, echo_app_chunking):
|
||||
"""
|
||||
Run the scm_app in Waitress.
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ def crypto_backend_class(request):
|
|||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def crypto_backend(crypto_backend_class):
|
||||
return crypto_backend_class()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def password():
|
||||
encoding = 'utf-8'
|
||||
value = u'value'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from rhodecode.lib.db_manage import DbManage
|
|||
from rhodecode.model import db
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def db_manage(baseapp):
|
||||
db_manage = DbManage(
|
||||
log_sql=True, dbconf='fake', root='fake', tests=False,
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class TestMixedFilenameEncodings(object):
|
|||
return fixture.load_resource(
|
||||
'hg_diff_mixed_filename_encodings.diff')
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def processor(self, raw_diff):
|
||||
diff = MercurialDiff(raw_diff)
|
||||
processor = DiffProcessor(diff)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ def test_find_context_end_of_chunk(diff_processor):
|
|||
assert found_line == [diffs.DiffLineNumber(old=13, new=14)]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def diff_processor(request, diff_fixture):
|
||||
raw_diff = diffs_store[diff_fixture]
|
||||
diff = GitDiff(raw_diff)
|
||||
|
|
@ -247,7 +247,7 @@ def diff_processor(request, diff_fixture):
|
|||
return processor
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def diff_fixture():
|
||||
return 'default.diff'
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def assert_called_with_mock(callable_, expected_mock_name):
|
|||
assert mock_name == expected_mock_name
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def hook_extras(user_regular, repo_stub):
|
||||
extras = utils2.AttributeDict({
|
||||
'ip': '127.0.0.1',
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ class MockServer(object):
|
|||
self.handler = Handler(self.request, ip_port, self)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def tcp_server():
|
||||
server = mock.Mock()
|
||||
server.server_address = ('127.0.0.1', 8881)
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ from rhodecode.lib.jsonalchemy import (
|
|||
MutationDict, MutationList, MutationObj, JsonType)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def engine():
|
||||
return create_engine('sqlite://')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def session(engine):
|
||||
return sessionmaker(bind=engine)()
|
||||
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ class TestDefaultRepoSettings(object):
|
|||
assert result[setting] == 'value'
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def fake_ui_values():
|
||||
return [
|
||||
UiSetting(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ from rhodecode.tests.fixture import Fixture
|
|||
fixture = Fixture()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo_name(backend_hg):
|
||||
return backend_hg.repo_name
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pytestmark = [
|
|||
@pytest.mark.usefixtures('config_stub')
|
||||
class TestPullRequestModel(object):
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def pull_request(self, request, backend, pr_util):
|
||||
"""
|
||||
A pull request combined with multiples patches.
|
||||
|
|
@ -538,7 +538,7 @@ def test_merge_response_message(mr_type, expected_msg):
|
|||
assert merge_response.merge_status_message == expected_msg
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def merge_extras(user_regular):
|
||||
"""
|
||||
Context for the vcs operation when running a merge.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from rhodecode.lib.vcs import nodes
|
|||
from rhodecode.model.repo import ReadmeFinder
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def commit_util(vcsbackend_stub):
|
||||
"""
|
||||
Provide a commit which has certain files in it's tree.
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class TestGetUsers(object):
|
|||
assert len(fake_users) == 3
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def test_user(request, baseapp):
|
||||
usr = UserModel().create_or_update(
|
||||
username=u'test_user',
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ fixture = Fixture()
|
|||
pytestmark = pytest.mark.usefixtures('baseapp')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def localizer():
|
||||
def func(msg):
|
||||
return msg
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ def activate_example_rcextensions(request):
|
|||
rhodecode.EXTENSIONS = old_extensions
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def capture_rcextensions():
|
||||
"""
|
||||
Returns the recorded calls to entry points in rcextensions.
|
||||
|
|
@ -192,7 +192,7 @@ def plain_http_host_stub():
|
|||
return 'example.com:80'
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def http_host_stub():
|
||||
"""
|
||||
Value of HTTP_HOST in the test run.
|
||||
|
|
@ -207,7 +207,7 @@ def plain_http_host_only_stub():
|
|||
return plain_http_host_stub().split(':')[0]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def http_host_only_stub():
|
||||
"""
|
||||
Value of HTTP_HOST in the test run.
|
||||
|
|
@ -232,7 +232,7 @@ def plain_http_environ():
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def http_environ():
|
||||
"""
|
||||
HTTP extra environ keys.
|
||||
|
|
@ -294,7 +294,7 @@ def _autologin_user(app, *args):
|
|||
return LoginData(csrf_token, session['rhodecode_user'])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def autologin_user(app):
|
||||
"""
|
||||
Utility fixture which makes sure that the admin user is logged in
|
||||
|
|
@ -302,7 +302,7 @@ def autologin_user(app):
|
|||
return _autologin_user(app)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def autologin_regular_user(app):
|
||||
"""
|
||||
Utility fixture which makes sure that the regular user is logged in
|
||||
|
|
@ -321,7 +321,7 @@ def xhr_header(request):
|
|||
return {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def real_crypto_backend(monkeypatch):
|
||||
"""
|
||||
Switch the production crypto backend on for this test.
|
||||
|
|
@ -356,7 +356,7 @@ def tests_tmp_path(request):
|
|||
return TESTS_TMP_PATH
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def test_repo_group(request):
|
||||
"""
|
||||
Create a temporary repository group, and destroy it after
|
||||
|
|
@ -373,7 +373,7 @@ def test_repo_group(request):
|
|||
return repo_group
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def test_user_group(request):
|
||||
"""
|
||||
Create a temporary user group, and destroy it after
|
||||
|
|
@ -464,7 +464,7 @@ def backend_base(request, backend_alias, baseapp, test_repo):
|
|||
return backend
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend(request, backend_alias, baseapp, test_repo):
|
||||
"""
|
||||
Parametrized fixture which represents a single backend implementation.
|
||||
|
|
@ -479,22 +479,22 @@ def backend(request, backend_alias, baseapp, test_repo):
|
|||
return backend_base(request, backend_alias, baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend_git(request, baseapp, test_repo):
|
||||
return backend_base(request, 'git', baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend_hg(request, baseapp, test_repo):
|
||||
return backend_base(request, 'hg', baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend_svn(request, baseapp, test_repo):
|
||||
return backend_base(request, 'svn', baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend_random(backend_git):
|
||||
"""
|
||||
Use this to express that your tests need "a backend.
|
||||
|
|
@ -511,7 +511,7 @@ def backend_random(backend_git):
|
|||
return backend_git
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def backend_stub(backend_git):
|
||||
"""
|
||||
Use this to express that your tests need a backend stub
|
||||
|
|
@ -522,7 +522,7 @@ def backend_stub(backend_git):
|
|||
return backend_git
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo_stub(backend_stub):
|
||||
"""
|
||||
Use this to express that your tests need a repository stub
|
||||
|
|
@ -722,7 +722,7 @@ def vcsbackend_base(request, backend_alias, tests_tmp_path, baseapp, test_repo):
|
|||
return backend
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcsbackend(request, backend_alias, tests_tmp_path, baseapp, test_repo):
|
||||
"""
|
||||
Parametrized fixture which represents a single vcs backend implementation.
|
||||
|
|
@ -736,22 +736,22 @@ def vcsbackend(request, backend_alias, tests_tmp_path, baseapp, test_repo):
|
|||
return vcsbackend_base(request, backend_alias, tests_tmp_path, baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcsbackend_git(request, tests_tmp_path, baseapp, test_repo):
|
||||
return vcsbackend_base(request, 'git', tests_tmp_path, baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcsbackend_hg(request, tests_tmp_path, baseapp, test_repo):
|
||||
return vcsbackend_base(request, 'hg', tests_tmp_path, baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcsbackend_svn(request, tests_tmp_path, baseapp, test_repo):
|
||||
return vcsbackend_base(request, 'svn', tests_tmp_path, baseapp, test_repo)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcsbackend_stub(vcsbackend_git):
|
||||
"""
|
||||
Use this to express that your test just needs a stub of a vcsbackend.
|
||||
|
|
@ -878,7 +878,7 @@ def _add_commits_to_repo(vcs_repo, commits):
|
|||
return commit_ids
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def reposerver(request):
|
||||
"""
|
||||
Allows to serve a backend repository
|
||||
|
|
@ -916,7 +916,7 @@ class RepoServer(object):
|
|||
proc.terminate()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def pr_util(backend, request, config_stub):
|
||||
"""
|
||||
Utility for tests of models and for functional tests around pull requests.
|
||||
|
|
@ -1117,7 +1117,7 @@ class PRTestUtility(object):
|
|||
self.mergeable_patcher.stop()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def user_admin(baseapp):
|
||||
"""
|
||||
Provides the default admin test user as an instance of `db.User`.
|
||||
|
|
@ -1126,7 +1126,7 @@ def user_admin(baseapp):
|
|||
return user
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def user_regular(baseapp):
|
||||
"""
|
||||
Provides the default regular test user as an instance of `db.User`.
|
||||
|
|
@ -1135,7 +1135,7 @@ def user_regular(baseapp):
|
|||
return user
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def user_util(request, db_connection):
|
||||
"""
|
||||
Provides a wired instance of `UserUtility` with integrated cleanup.
|
||||
|
|
@ -1468,7 +1468,7 @@ class AppenlightClient(object):
|
|||
raise Exception('Sending to appenlight failed')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def gist_util(request, db_connection):
|
||||
"""
|
||||
Provides a wired instance of `GistUtility` with integrated cleanup.
|
||||
|
|
@ -1493,13 +1493,13 @@ class GistUtility(object):
|
|||
self.fixture.destroy_gists(str(id_))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def enabled_backends(request):
|
||||
backends = request.config.option.backends
|
||||
return backends[:]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def settings_util(request, db_connection):
|
||||
"""
|
||||
Provides a wired instance of `SettingsUtility` with integrated cleanup.
|
||||
|
|
@ -1591,7 +1591,7 @@ class SettingsUtility(object):
|
|||
Session().commit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def no_notifications(request):
|
||||
notification_patcher = mock.patch(
|
||||
'rhodecode.model.notification.NotificationModel.create')
|
||||
|
|
@ -1610,12 +1610,12 @@ def repeat(request):
|
|||
return request.config.getoption('--repeat')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def rhodecode_fixtures():
|
||||
return Fixture()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def context_stub():
|
||||
"""
|
||||
Stub context object.
|
||||
|
|
@ -1624,7 +1624,7 @@ def context_stub():
|
|||
return context
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def request_stub():
|
||||
"""
|
||||
Stub request object.
|
||||
|
|
@ -1634,7 +1634,7 @@ def request_stub():
|
|||
return request
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def config_stub(request, request_stub):
|
||||
"""
|
||||
Set up pyramid.testing and return the Configurator.
|
||||
|
|
@ -1649,7 +1649,7 @@ def config_stub(request, request_stub):
|
|||
return config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def StubIntegrationType():
|
||||
class _StubIntegrationType(IntegrationTypeBase):
|
||||
""" Test integration type class """
|
||||
|
|
@ -1686,7 +1686,7 @@ def StubIntegrationType():
|
|||
integration_type_registry.register_integration_type(_StubIntegrationType)
|
||||
return _StubIntegrationType
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_integration_settings():
|
||||
return {
|
||||
'test_string_field': 'some data',
|
||||
|
|
@ -1694,7 +1694,7 @@ def stub_integration_settings():
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo_integration_stub(request, repo_stub, StubIntegrationType,
|
||||
stub_integration_settings):
|
||||
integration = IntegrationModel().create(
|
||||
|
|
@ -1709,7 +1709,7 @@ def repo_integration_stub(request, repo_stub, StubIntegrationType,
|
|||
return integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repogroup_integration_stub(request, test_repo_group, StubIntegrationType,
|
||||
stub_integration_settings):
|
||||
integration = IntegrationModel().create(
|
||||
|
|
@ -1724,7 +1724,7 @@ def repogroup_integration_stub(request, test_repo_group, StubIntegrationType,
|
|||
return integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repogroup_recursive_integration_stub(request, test_repo_group,
|
||||
StubIntegrationType, stub_integration_settings):
|
||||
integration = IntegrationModel().create(
|
||||
|
|
@ -1739,7 +1739,7 @@ def repogroup_recursive_integration_stub(request, test_repo_group,
|
|||
return integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def global_integration_stub(request, StubIntegrationType,
|
||||
stub_integration_settings):
|
||||
integration = IntegrationModel().create(
|
||||
|
|
@ -1754,7 +1754,7 @@ def global_integration_stub(request, StubIntegrationType,
|
|||
return integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def root_repos_integration_stub(request, StubIntegrationType,
|
||||
stub_integration_settings):
|
||||
integration = IntegrationModel().create(
|
||||
|
|
@ -1769,7 +1769,7 @@ def root_repos_integration_stub(request, StubIntegrationType,
|
|||
return integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def local_dt_to_utc():
|
||||
def _factory(dt):
|
||||
return dt.replace(tzinfo=dateutil.tz.tzlocal()).astimezone(
|
||||
|
|
@ -1777,7 +1777,7 @@ def local_dt_to_utc():
|
|||
return _factory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def disable_anonymous_user(request, baseapp):
|
||||
set_anonymous_access(False)
|
||||
|
||||
|
|
@ -1791,7 +1791,7 @@ def rc_fixture(request):
|
|||
return Fixture()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo_groups(request):
|
||||
fixture = Fixture()
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ def available_port_factory():
|
|||
return get_available_port
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def available_port(available_port_factory):
|
||||
"""
|
||||
Gives you one free port for the current test.
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ def _create_empty_repository(cls, backend_alias=None):
|
|||
return repo
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def config():
|
||||
"""
|
||||
Instance of a repository config.
|
||||
|
|
@ -151,7 +151,7 @@ def _add_commits_to_repo(repo, commits):
|
|||
return tip
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def vcs_repo(request, backend_alias):
|
||||
Backend = get_backend(backend_alias)
|
||||
repo_path = get_new_dir(str(time.time()))
|
||||
|
|
@ -164,7 +164,7 @@ def vcs_repo(request, backend_alias):
|
|||
return repo
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def generate_repo_with_commits(vcs_repo):
|
||||
"""
|
||||
Creates a fabric to generate N comits with some file nodes on a randomly
|
||||
|
|
@ -194,7 +194,7 @@ def generate_repo_with_commits(vcs_repo):
|
|||
return commit_maker
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def hg_repo(request, vcs_repo):
|
||||
repo = vcs_repo
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ def hg_repo(request, vcs_repo):
|
|||
return repo
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def hg_commit(hg_repo):
|
||||
return hg_repo.get_commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class TestArchives(BackendTestMixin):
|
|||
self.tip.archive_repo(self.temp_file, kind='wrong kind')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def base_commit():
|
||||
"""
|
||||
Prepare a `base.BaseCommit` just enough for `_validate_archive_prefix`.
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ def is_new_connection(logger, level, message):
|
|||
message.startswith('Starting new HTTP'))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_session():
|
||||
"""
|
||||
Stub of `requests.Session()`.
|
||||
|
|
@ -48,7 +48,7 @@ def stub_session():
|
|||
return session
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_fail_session():
|
||||
"""
|
||||
Stub of `requests.Session()`.
|
||||
|
|
@ -62,7 +62,7 @@ def stub_fail_session():
|
|||
return session
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_session_factory(stub_session):
|
||||
"""
|
||||
Stub of `rhodecode.lib.vcs.client_http.ThreadlocalSessionFactory`.
|
||||
|
|
@ -72,7 +72,7 @@ def stub_session_factory(stub_session):
|
|||
return session_factory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def stub_session_failing_factory(stub_fail_session):
|
||||
"""
|
||||
Stub of `rhodecode.lib.vcs.client_http.ThreadlocalSessionFactory`.
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ TODO: To be written...
|
|||
|
||||
class TestGetShadowInstance(object):
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo(self, vcsbackend_hg, monkeypatch):
|
||||
repo = vcsbackend_hg.repo
|
||||
monkeypatch.setattr(repo, 'config', mock.Mock())
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ from rhodecode.lib.vcs.nodes import DirNode, FileNode
|
|||
from rhodecode.tests.vcs.conftest import BackendTestMixin
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def nodes():
|
||||
nodes = [
|
||||
FileNode('foobar', content='Foo & bar'),
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ pytestmark = [
|
|||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def repo(baseapp):
|
||||
repo = SubversionRepository(os.path.join(TESTS_TMP_PATH, SVN_REPO))
|
||||
return repo
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def head(repo):
|
||||
return repo.get_commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ def rc_web_server(
|
|||
return server
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def disable_locking(baseapp):
|
||||
r = Repository.get_by_repo_name(GIT_REPO)
|
||||
Repository.unlock(r)
|
||||
|
|
@ -170,7 +170,7 @@ def disable_locking(baseapp):
|
|||
Session().commit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def enable_auth_plugins(request, baseapp, csrf_token):
|
||||
"""
|
||||
Return a factory object that when called, allows to control which
|
||||
|
|
@ -217,7 +217,7 @@ def enable_auth_plugins(request, baseapp, csrf_token):
|
|||
return _enable_plugins
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def fs_repo_only(request, rhodecode_fixtures):
|
||||
def fs_repo_fabric(repo_name, repo_type):
|
||||
rhodecode_fixtures.create_repo(repo_name, repo_type=repo_type)
|
||||
|
|
@ -232,7 +232,7 @@ def fs_repo_only(request, rhodecode_fixtures):
|
|||
return fs_repo_fabric
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def enable_webhook_push_integration(request):
|
||||
integration = Integration()
|
||||
integration.integration_type = WebhookIntegrationType.key
|
||||
|
|
@ -269,7 +269,7 @@ def enable_webhook_push_integration(request):
|
|||
Session().commit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture()
|
||||
def branch_permission_setter(request):
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue