# HG changeset patch # User Marcin Kuzminski # Date 2019-09-28 21:04:18 # Node ID 39fb0295876d4d2b1407eefd6f04e09141e36640 # Parent cc085be61ea306a4b39df4723d6470f4a06ebcc4 pytest: use consistent way of creating a fixture by using pytest.fixture() diff --git a/rhodecode/api/tests/test_get_server_info.py b/rhodecode/api/tests/test_get_server_info.py --- a/rhodecode/api/tests/test_get_server_info.py +++ b/rhodecode/api/tests/test_get_server_info.py @@ -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 diff --git a/rhodecode/apps/admin/tests/test_admin_settings.py b/rhodecode/apps/admin/tests/test_admin_settings.py --- a/rhodecode/apps/admin/tests/test_admin_settings.py +++ b/rhodecode/apps/admin/tests/test_admin_settings.py @@ -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() diff --git a/rhodecode/apps/gist/tests/test_admin_gists.py b/rhodecode/apps/gist/tests/test_admin_gists.py --- a/rhodecode/apps/gist/tests/test_admin_gists.py +++ b/rhodecode/apps/gist/tests/test_admin_gists.py @@ -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) diff --git a/rhodecode/apps/repository/tests/test_repo_summary.py b/rhodecode/apps/repository/tests/test_repo_summary.py --- a/rhodecode/apps/repository/tests/test_repo_summary.py +++ b/rhodecode/apps/repository/tests/test_repo_summary.py @@ -327,7 +327,7 @@ def summary_view(context_stub, request_s @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 = [ diff --git a/rhodecode/apps/ssh_support/tests/conftest.py b/rhodecode/apps/ssh_support/tests/conftest.py --- a/rhodecode/apps/ssh_support/tests/conftest.py +++ b/rhodecode/apps/ssh_support/tests/conftest.py @@ -26,7 +26,7 @@ from rhodecode.apps.ssh_support.lib.ssh_ 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( diff --git a/rhodecode/apps/ssh_support/tests/test_server_git.py b/rhodecode/apps/ssh_support/tests/test_server_git.py --- a/rhodecode/apps/ssh_support/tests/test_server_git.py +++ b/rhodecode/apps/ssh_support/tests/test_server_git.py @@ -63,7 +63,7 @@ class GitServerCreator(object): return server -@pytest.fixture +@pytest.fixture() def git_server(app): return GitServerCreator() diff --git a/rhodecode/apps/ssh_support/tests/test_server_hg.py b/rhodecode/apps/ssh_support/tests/test_server_hg.py --- a/rhodecode/apps/ssh_support/tests/test_server_hg.py +++ b/rhodecode/apps/ssh_support/tests/test_server_hg.py @@ -62,7 +62,7 @@ class MercurialServerCreator(object): return server -@pytest.fixture +@pytest.fixture() def hg_server(app): return MercurialServerCreator() diff --git a/rhodecode/apps/ssh_support/tests/test_server_svn.py b/rhodecode/apps/ssh_support/tests/test_server_svn.py --- a/rhodecode/apps/ssh_support/tests/test_server_svn.py +++ b/rhodecode/apps/ssh_support/tests/test_server_svn.py @@ -61,7 +61,7 @@ class SubversionServerCreator(object): return server -@pytest.fixture +@pytest.fixture() def svn_server(app): return SubversionServerCreator() diff --git a/rhodecode/config/patches.py b/rhodecode/config/patches.py --- a/rhodecode/config/patches.py +++ b/rhodecode/config/patches.py @@ -32,7 +32,6 @@ Please keep the following principles in """ - def inspect_getargspec(): """ Pyramid rely on inspect.getargspec to lookup the signature of diff --git a/rhodecode/tests/config/test_environment.py b/rhodecode/tests/config/test_environment.py --- a/rhodecode/tests/config/test_environment.py +++ b/rhodecode/tests/config/test_environment.py @@ -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. diff --git a/rhodecode/tests/database/conftest.py b/rhodecode/tests/database/conftest.py --- a/rhodecode/tests/database/conftest.py +++ b/rhodecode/tests/database/conftest.py @@ -59,7 +59,7 @@ def pytest_collection_modifyitems(sessio items[:] = remaining -@pytest.fixture +@pytest.fixture() def db_backend( request, db_backend_name, ini_config, tmpdir_factory): basetemp = tmpdir_factory.getbasetemp().strpath diff --git a/rhodecode/tests/events/test_repo.py b/rhodecode/tests/events/test_repo.py --- a/rhodecode/tests/events/test_repo.py +++ b/rhodecode/tests/events/test_repo.py @@ -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', diff --git a/rhodecode/tests/integrations/conftest.py b/rhodecode/tests/integrations/conftest.py --- a/rhodecode/tests/integrations/conftest.py +++ b/rhodecode/tests/integrations/conftest.py @@ -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'}, diff --git a/rhodecode/tests/integrations/test_integration.py b/rhodecode/tests/integrations/test_integration.py --- a/rhodecode/tests/integrations/test_integration.py +++ b/rhodecode/tests/integrations/test_integration.py @@ -47,7 +47,7 @@ class TestDeleteScopesDeletesIntegration 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 diff --git a/rhodecode/tests/integrations/test_slack.py b/rhodecode/tests/integrations/test_slack.py --- a/rhodecode/tests/integrations/test_slack.py +++ b/rhodecode/tests/integrations/test_slack.py @@ -26,7 +26,7 @@ from rhodecode.model.db import Session, 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' diff --git a/rhodecode/tests/integrations/test_webhook.py b/rhodecode/tests/integrations/test_webhook.py --- a/rhodecode/tests/integrations/test_webhook.py +++ b/rhodecode/tests/integrations/test_webhook.py @@ -25,7 +25,7 @@ from rhodecode.lib.utils2 import Attribu from rhodecode.integrations.types.webhook import WebhookDataHandler -@pytest.fixture +@pytest.fixture() def base_data(): return { 'name': 'event', diff --git a/rhodecode/tests/lib/auth_modules/test_auth_modules.py b/rhodecode/tests/lib/auth_modules/test_auth_modules.py --- a/rhodecode/tests/lib/auth_modules/test_auth_modules.py +++ b/rhodecode/tests/lib/auth_modules/test_auth_modules.py @@ -77,7 +77,7 @@ def test_authenticate_migrates_to_new_ha assert result == stub_auth_data -@pytest.fixture +@pytest.fixture() def stub_auth_data(user_util): user = user_util.create_user() data = { diff --git a/rhodecode/tests/lib/middleware/test_simplevcs.py b/rhodecode/tests/lib/middleware/test_simplevcs.py --- a/rhodecode/tests/lib/middleware/test_simplevcs.py +++ b/rhodecode/tests/lib/middleware/test_simplevcs.py @@ -73,7 +73,7 @@ class StubVCSController(simplevcs.Simple return None -@pytest.fixture +@pytest.fixture() def vcscontroller(baseapp, config_stub, request_stub): config_stub.testing_securitypolicy() config_stub.include('rhodecode.authentication') diff --git a/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py b/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py --- a/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py +++ b/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py @@ -40,7 +40,7 @@ def test_does_chunked_end_to_end_transfe 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 return echo_app_url -@pytest.fixture +@pytest.fixture() def scm_app(request, available_port_factory, echo_app_chunking): """ Run the scm_app in Waitress. diff --git a/rhodecode/tests/lib/test_auth_crypto_backend.py b/rhodecode/tests/lib/test_auth_crypto_backend.py --- a/rhodecode/tests/lib/test_auth_crypto_backend.py +++ b/rhodecode/tests/lib/test_auth_crypto_backend.py @@ -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' diff --git a/rhodecode/tests/lib/test_db_manage.py b/rhodecode/tests/lib/test_db_manage.py --- a/rhodecode/tests/lib/test_db_manage.py +++ b/rhodecode/tests/lib/test_db_manage.py @@ -25,7 +25,7 @@ from rhodecode.lib.db_manage import DbMa 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, diff --git a/rhodecode/tests/lib/test_diffs.py b/rhodecode/tests/lib/test_diffs.py --- a/rhodecode/tests/lib/test_diffs.py +++ b/rhodecode/tests/lib/test_diffs.py @@ -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) diff --git a/rhodecode/tests/lib/test_diffs_context.py b/rhodecode/tests/lib/test_diffs_context.py --- a/rhodecode/tests/lib/test_diffs_context.py +++ b/rhodecode/tests/lib/test_diffs_context.py @@ -238,7 +238,7 @@ def test_find_context_end_of_chunk(diff_ 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' diff --git a/rhodecode/tests/lib/test_hooks_base.py b/rhodecode/tests/lib/test_hooks_base.py --- a/rhodecode/tests/lib/test_hooks_base.py +++ b/rhodecode/tests/lib/test_hooks_base.py @@ -61,7 +61,7 @@ def assert_called_with_mock(callable_, e 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', diff --git a/rhodecode/tests/lib/test_hooks_daemon.py b/rhodecode/tests/lib/test_hooks_daemon.py --- a/rhodecode/tests/lib/test_hooks_daemon.py +++ b/rhodecode/tests/lib/test_hooks_daemon.py @@ -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) diff --git a/rhodecode/tests/lib/test_jsonalchemy.py b/rhodecode/tests/lib/test_jsonalchemy.py --- a/rhodecode/tests/lib/test_jsonalchemy.py +++ b/rhodecode/tests/lib/test_jsonalchemy.py @@ -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)() diff --git a/rhodecode/tests/models/settings/test_settings.py b/rhodecode/tests/models/settings/test_settings.py --- a/rhodecode/tests/models/settings/test_settings.py +++ b/rhodecode/tests/models/settings/test_settings.py @@ -797,7 +797,7 @@ class TestDefaultRepoSettings(object): assert result[setting] == 'value' -@pytest.fixture +@pytest.fixture() def fake_ui_values(): return [ UiSetting( diff --git a/rhodecode/tests/models/test_permissions.py b/rhodecode/tests/models/test_permissions.py --- a/rhodecode/tests/models/test_permissions.py +++ b/rhodecode/tests/models/test_permissions.py @@ -36,7 +36,7 @@ from rhodecode.tests.fixture import Fixt fixture = Fixture() -@pytest.fixture +@pytest.fixture() def repo_name(backend_hg): return backend_hg.repo_name diff --git a/rhodecode/tests/models/test_pullrequest.py b/rhodecode/tests/models/test_pullrequest.py --- a/rhodecode/tests/models/test_pullrequest.py +++ b/rhodecode/tests/models/test_pullrequest.py @@ -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, 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. diff --git a/rhodecode/tests/models/test_repo_readme.py b/rhodecode/tests/models/test_repo_readme.py --- a/rhodecode/tests/models/test_repo_readme.py +++ b/rhodecode/tests/models/test_repo_readme.py @@ -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. diff --git a/rhodecode/tests/models/test_users.py b/rhodecode/tests/models/test_users.py --- a/rhodecode/tests/models/test_users.py +++ b/rhodecode/tests/models/test_users.py @@ -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', diff --git a/rhodecode/tests/other/test_validators.py b/rhodecode/tests/other/test_validators.py --- a/rhodecode/tests/other/test_validators.py +++ b/rhodecode/tests/other/test_validators.py @@ -40,7 +40,7 @@ fixture = Fixture() pytestmark = pytest.mark.usefixtures('baseapp') -@pytest.fixture +@pytest.fixture() def localizer(): def func(msg): return msg diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -164,7 +164,7 @@ def activate_example_rcextensions(reques 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, 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, base 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_ali 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, t 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, commi 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_ 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, 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 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, Stu 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, 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() diff --git a/rhodecode/tests/pylons_plugin.py b/rhodecode/tests/pylons_plugin.py --- a/rhodecode/tests/pylons_plugin.py +++ b/rhodecode/tests/pylons_plugin.py @@ -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. diff --git a/rhodecode/tests/vcs/conftest.py b/rhodecode/tests/vcs/conftest.py --- a/rhodecode/tests/vcs/conftest.py +++ b/rhodecode/tests/vcs/conftest.py @@ -112,7 +112,7 @@ def _create_empty_repository(cls, backen 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() diff --git a/rhodecode/tests/vcs/test_archives.py b/rhodecode/tests/vcs/test_archives.py --- a/rhodecode/tests/vcs/test_archives.py +++ b/rhodecode/tests/vcs/test_archives.py @@ -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`. diff --git a/rhodecode/tests/vcs/test_client_http.py b/rhodecode/tests/vcs/test_client_http.py --- a/rhodecode/tests/vcs/test_client_http.py +++ b/rhodecode/tests/vcs/test_client_http.py @@ -34,7 +34,7 @@ def is_new_connection(logger, level, mes 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`. diff --git a/rhodecode/tests/vcs/test_hg.py b/rhodecode/tests/vcs/test_hg.py --- a/rhodecode/tests/vcs/test_hg.py +++ b/rhodecode/tests/vcs/test_hg.py @@ -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()) diff --git a/rhodecode/tests/vcs/test_inmemory.py b/rhodecode/tests/vcs/test_inmemory.py --- a/rhodecode/tests/vcs/test_inmemory.py +++ b/rhodecode/tests/vcs/test_inmemory.py @@ -34,7 +34,7 @@ from rhodecode.lib.vcs.nodes import DirN from rhodecode.tests.vcs.conftest import BackendTestMixin -@pytest.fixture +@pytest.fixture() def nodes(): nodes = [ FileNode('foobar', content='Foo & bar'), diff --git a/rhodecode/tests/vcs/test_svn.py b/rhodecode/tests/vcs/test_svn.py --- a/rhodecode/tests/vcs/test_svn.py +++ b/rhodecode/tests/vcs/test_svn.py @@ -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() diff --git a/rhodecode/tests/vcs_operations/conftest.py b/rhodecode/tests/vcs_operations/conftest.py --- a/rhodecode/tests/vcs_operations/conftest.py +++ b/rhodecode/tests/vcs_operations/conftest.py @@ -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 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_fixt 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(requ Session().commit() -@pytest.fixture +@pytest.fixture() def branch_permission_setter(request): """