{"action":"closed","issue":{"url":"https://api.github.com/repos/celery/celery/issues/5196","repository_url":"https://api.github.com/repos/celery/celery","labels_url":"https://api.github.com/repos/celery/celery/issues/5196/labels{/name}","comments_url":"https://api.github.com/repos/celery/celery/issues/5196/comments","events_url":"https://api.github.com/repos/celery/celery/issues/5196/events","html_url":"https://github.com/celery/celery/issues/5196","id":384189333,"node_id":"MDU6SXNzdWUzODQxODkzMzM=","number":5196,"title":"EncodeError when running Celery unit tests","user":{"login":"ianhoffman","id":13488540,"node_id":"MDQ6VXNlcjEzNDg4NTQw","avatar_url":"https://avatars0.githubusercontent.com/u/13488540?v=4","gravatar_id":"","url":"https://api.github.com/users/ianhoffman","html_url":"https://github.com/ianhoffman","followers_url":"https://api.github.com/users/ianhoffman/followers","following_url":"https://api.github.com/users/ianhoffman/following{/other_user}","gists_url":"https://api.github.com/users/ianhoffman/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhoffman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhoffman/subscriptions","organizations_url":"https://api.github.com/users/ianhoffman/orgs","repos_url":"https://api.github.com/users/ianhoffman/repos","events_url":"https://api.github.com/users/ianhoffman/events{/privacy}","received_events_url":"https://api.github.com/users/ianhoffman/received_events","type":"User","site_admin":false},"labels":[{"id":12871367,"node_id":"MDU6TGFiZWwxMjg3MTM2Nw==","url":"https://api.github.com/repos/celery/celery/labels/Category:%20Tests","name":"Category: Tests","color":"02e10c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/celery/celery/milestones/20","html_url":"https://github.com/celery/celery/milestone/20","labels_url":"https://api.github.com/repos/celery/celery/milestones/20/labels","id":3359245,"node_id":"MDk6TWlsZXN0b25lMzM1OTI0NQ==","number":20,"title":"v4.3","description":"The last version to support python2","creator":{"login":"thedrow","id":48936,"node_id":"MDQ6VXNlcjQ4OTM2","avatar_url":"https://avatars2.githubusercontent.com/u/48936?v=4","gravatar_id":"","url":"https://api.github.com/users/thedrow","html_url":"https://github.com/thedrow","followers_url":"https://api.github.com/users/thedrow/followers","following_url":"https://api.github.com/users/thedrow/following{/other_user}","gists_url":"https://api.github.com/users/thedrow/gists{/gist_id}","starred_url":"https://api.github.com/users/thedrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedrow/subscriptions","organizations_url":"https://api.github.com/users/thedrow/orgs","repos_url":"https://api.github.com/users/thedrow/repos","events_url":"https://api.github.com/users/thedrow/events{/privacy}","received_events_url":"https://api.github.com/users/thedrow/received_events","type":"User","site_admin":false},"open_issues":48,"closed_issues":97,"state":"open","created_at":"2018-05-20T07:51:39Z","updated_at":"2018-11-27T17:59:21Z","due_on":"2018-12-01T08:00:00Z","closed_at":null},"comments":1,"created_at":"2018-11-26T06:20:39Z","updated_at":"2018-11-27T17:59:20Z","closed_at":"2018-11-27T17:59:20Z","author_association":"NONE","body":"When running unit tests against the master branch of Celery, I get the following traceback:\r\n\r\n```\r\n―――――――――――――――――――――――――――――――――――――――――――――― ERROR at setup of test_GroupResult.test_is_pickleable ――――――――――――――――――――――――――――――――――――――――――――――\r\n\r\nself = <t.unit.tasks.test_result.test_GroupResult instance at 0x7f641194a8c0>\r\n\r\n>   ???\r\n\r\nt/unit/tasks/test_result.py:611: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\nt/unit/tasks/test_result.py:54: in make_mock_group\r\n    ???\r\nt/unit/tasks/test_result.py:41: in save_result\r\n    ???\r\ncelery/backends/base.py:146: in mark_as_done\r\n    self.store_result(task_id, result, state, request=request)\r\ncelery/backends/base.py:322: in store_result\r\n    request=request, **kwargs)\r\ncelery/backends/base.py:692: in _store_result\r\n    self.set(self.get_key_for_task(task_id), self.encode(meta))\r\ncelery/backends/base.py:272: in encode\r\n    _, _, payload = self._encode(data)\r\ncelery/backends/base.py:276: in _encode\r\n    return dumps(data, serializer=self.serializer)\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/kombu/serialization.py:221: in dumps\r\n    payload = encoder(data)\r\n.pyenv/versions/python2.7/lib/python2.7/contextlib.py:35: in __exit__\r\n    ???\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/kombu/serialization.py:54: in _reraise_errors\r\n    reraise(wrapper, wrapper(exc), sys.exc_info()[2])\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/kombu/serialization.py:50: in _reraise_errors\r\n    yield\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/kombu/serialization.py:221: in dumps\r\n    payload = encoder(data)\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/kombu/utils/json.py:69: in dumps\r\n    **dict(default_kwargs, **kwargs))\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/simplejson/__init__.py:399: in dumps\r\n    **kw).encode(obj)\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/simplejson/encoder.py:296: in encode\r\n    chunks = self.iterencode(o, _one_shot=True)\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/simplejson/encoder.py:378: in iterencode\r\n    return _iterencode(o, 0)\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/cyanide/data.py:18: in default\r\n    return super(JSONEncoder, self).default(obj)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <cyanide.data.JSONEncoder object at 0x7f6411656110>, o = datetime.datetime(2018, 11, 26, 6, 0, 3, 498658)\r\n\r\n    def default(self, o):\r\n        \"\"\"Implement this method in a subclass such that it returns\r\n            a serializable object for ``o``, or calls the base implementation\r\n            (to raise a ``TypeError``).\r\n    \r\n            For example, to support arbitrary iterators, you could\r\n            implement default like this::\r\n    \r\n                def default(self, o):\r\n                    try:\r\n                        iterable = iter(o)\r\n                    except TypeError:\r\n                        pass\r\n                    else:\r\n                        return list(iterable)\r\n                    return JSONEncoder.default(self, o)\r\n    \r\n            \"\"\"\r\n        raise TypeError('Object of type %s is not JSON serializable' %\r\n>                       o.__class__.__name__)\r\nE       EncodeError: Object of type datetime is not JSON serializable\r\n\r\n.pyenv/versions/python2.7/lib/python2.7/site-packages/simplejson/encoder.py:273: EncodeError\r\n```\r\n\r\n## Steps to reproduce\r\n\r\n- Fork master\r\n- Clone forked master branch\r\n- Build docker image\r\n- Run tests in docker image\r\n\r\n(This is essentially the flow described [here](http://docs.celeryproject.org/en/master/contributing.html#id30).)\r\n\r\n## Expected behavior\r\n\r\ndatetimes will be json serializable.\r\n\r\n## Actual behavior\r\n\r\nAn error is thrown during setup.\r\n\r\n\r\nI'm happy to try to fix this bug, if it is indeed a bug and not a configuration issue. Just wanted to make sure I'm headed down the right path before I get a PR together:\r\n\r\n- One fix would be to provide a custom JSON-serializer when to `self.app.conf.default_serializer` for this test class.\r\n- Another would be to use a different default serializer for these tests (pickle?).\r\n- Or even mock out \"datetime.datetime.now()` to return `None`.\r\n\r\nNone of these really same like safe / desirable fixes, so perhaps a more experienced Celery-er can point me in the right direction.\r\n\r\nThanks a lot!"}}
{"actor":{"display_login":"auvipy"}}