{"action":"created","issue":{"url":"https://api.github.com/repos/celery/celery/issues/4032","repository_url":"https://api.github.com/repos/celery/celery","labels_url":"https://api.github.com/repos/celery/celery/issues/4032/labels{/name}","comments_url":"https://api.github.com/repos/celery/celery/issues/4032/comments","events_url":"https://api.github.com/repos/celery/celery/issues/4032/events","html_url":"https://github.com/celery/celery/issues/4032","id":229093868,"number":4032,"title":"result_backend cannot be configured in pytest ","user":{"login":"cadupont","id":15399,"avatar_url":"https://avatars2.githubusercontent.com/u/15399?v=3","gravatar_id":"","url":"https://api.github.com/users/cadupont","html_url":"https://github.com/cadupont","followers_url":"https://api.github.com/users/cadupont/followers","following_url":"https://api.github.com/users/cadupont/following{/other_user}","gists_url":"https://api.github.com/users/cadupont/gists{/gist_id}","starred_url":"https://api.github.com/users/cadupont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadupont/subscriptions","organizations_url":"https://api.github.com/users/cadupont/orgs","repos_url":"https://api.github.com/users/cadupont/repos","events_url":"https://api.github.com/users/cadupont/events{/privacy}","received_events_url":"https://api.github.com/users/cadupont/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-16T16:29:30Z","updated_at":"2017-05-16T17:57:57Z","closed_at":null,"body":"## Checklist\r\n\r\n- [x] I have included the output of ``celery -A proj report`` in the issue.\r\n      (if you are not able to do this, then at least specify the Celery\r\n       version affected).\r\n- [x] I have verified that the issue exists against the `master` branch of Celery.\r\n\r\n----------------------------------------------\r\ncelery -A firehose.tasks.orchestration report\r\n\r\nsoftware -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.5.2\r\n            billiard:3.5.0.2 py-amqp:2.1.4\r\nplatform -> system:Darwin arch:64bit imp:CPython\r\nloader   -> celery.loaders.app.AppLoader\r\nsettings -> transport:pyamqp results:redis://localhost:6379/0\r\n\r\nresult_backend: 'redis://localhost:6379/0'\r\nbroker_url: 'amqp://guest:********@localhost:5672//'\r\n----------------------------------------------\r\n\r\n\r\n## Steps to reproduce\r\nCreate one celery task in a separate file, import the celery task and try to get its result from within a pytest test. Try specifying the result backend via marks or fixtures.\r\ne.g.\r\n```\r\nfrom ... import fetch\r\nimport pytest\r\n\r\n@pytest.mark.celery(result_backend='redis://localhost:6379/0')\r\ndef test_successful_orchestration(celery_worker): \r\n    f = fetch.delay()\r\n    assert f.get() == 'result'\r\n```\r\nI also have the same result if I try with the config fixture\r\n```\r\n@pytest.fixture(scope='session')\r\ndef celery_config():\r\n    return {\r\n        \"result_backend\": \"redis://localhost/0\",\r\n        \"broker_url\": \"amqp://guest:guest@localhost:5672//\"\r\n    }\r\n```\r\n\r\n\r\n## Expected behavior\r\nI would expect the result_backend to be available to the test.\r\nNote that when I launch a worker separately, when I am not testing, with the same backend settings, it works.\r\n\r\n\r\n## Actual behavior\r\nRunning pytest mytest.py returns:\r\n\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n../../.pyenv/versions/3.5.2/envs/celery3.5.2/lib/python3.5/site-packages/celery/result.py:194: in get\r\n    on_message=on_message,\r\n../../.pyenv/versions/3.5.2/envs/celery3.5.2/lib/python3.5/site-packages/celery/backends/base.py:466: in wait_for_pending\r\n    no_ack=no_ack,\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <celery.backends.base.DisabledBackend object at 0x1103d5518>, args = ('985a0f2e-ff3a-4ada-a045-11137f358694',), kwargs = {'interval': 0.5, 'no_ack': True, 'on_interval': <promise@0x1105f0048>, 'timeout': None}\r\n\r\n    def _is_disabled(self, *args, **kwargs):\r\n>       raise NotImplementedError(E_NO_BACKEND.strip())\r\nE       NotImplementedError: No result backend is configured.\r\nE       Please see the documentation for more information.\r\n\r\n../../.pyenv/versions/3.5.2/envs/celery3.5.2/lib/python3.5/site-packages/celery/backends/base.py:772: NotImplementedError\r\n"},"comment":{"url":"https://api.github.com/repos/celery/celery/issues/comments/301863491","html_url":"https://github.com/celery/celery/issues/4032#issuecomment-301863491","issue_url":"https://api.github.com/repos/celery/celery/issues/4032","id":301863491,"user":{"login":"georgepsarakis","id":963304,"avatar_url":"https://avatars2.githubusercontent.com/u/963304?v=3","gravatar_id":"","url":"https://api.github.com/users/georgepsarakis","html_url":"https://github.com/georgepsarakis","followers_url":"https://api.github.com/users/georgepsarakis/followers","following_url":"https://api.github.com/users/georgepsarakis/following{/other_user}","gists_url":"https://api.github.com/users/georgepsarakis/gists{/gist_id}","starred_url":"https://api.github.com/users/georgepsarakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgepsarakis/subscriptions","organizations_url":"https://api.github.com/users/georgepsarakis/orgs","repos_url":"https://api.github.com/users/georgepsarakis/repos","events_url":"https://api.github.com/users/georgepsarakis/events{/privacy}","received_events_url":"https://api.github.com/users/georgepsarakis/received_events","type":"User","site_admin":false},"created_at":"2017-05-16T17:57:57Z","updated_at":"2017-05-16T17:57:57Z","body":"Not sure if I fully understand the issue, but you can see how the broker and result backend is configured for running the tests in the [tox.ini](https://github.com/celery/celery/blob/master/tox.ini#L33) file."}}
{"actor":{"display_login":"georgepsarakis"}}